<template>
  <div class="app-container">
    <el-card shadow="never" :body-style="{ padding: '5px' }">
      <div style="display: flex; align-items: stretch">
        <div style="width: 17.5%">
          <div style="width: 95%; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              @inputDBclick="inputDBclick"
              :OriginalFilter="{ static: true }"
              style="margin-left: 15px"
              :searchImg="false"
              :formList="formList1"
              @Launchform="Launchform1"
              @findClicked="findClicked"
            />
            <div slot="header" class="f16"></div>

            <div style="width: 100%">
              <Table
                @currentRow="currentRow1"
                :tableHeader="tableHeader"
                :tableData="TypeQueryMethodsTableDateList"
                :TableHeight="50"
                :outTableHeight="150"
                :isLoading="isLoading11"
              />
              <PageModule
                :PageData="{ total: totalTk, buttonS: true, pageSizeShow: true }"
                :layout="'prev, pager'"
                @pageSizeChange="handleSizeChangeTk"
                @pageChange="handleCurrentChangeTk"
              />
            </div>

            <div style="width: 100%">
              <Table
                :isLoading="isLoading15"
                @currentRow="currentRow2"
                :tableHeader="tableHeader2"
                :tableData="ColorCodePictureMethodsParmsTableDateList.list"
                :TableHeight="40"
                :outTableHeight="150"
              />
              <!-- <PageModule :PageData="{ total: total, buttonS: true, pageSizeShow: true }" :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange" @pageChange="handleCurrentChange" /> -->
              <!-- <div style="width: 50%;height: 100px;">
                <img :src="image" alt="">
              </div> -->

              <div class="demo-image__preview">
                <el-image
                  style="width: 100%; height: 150px"
                  :src="image"
                  :preview-src-list="imgList"
                  :initial-index="4"
                  fit="cover"
                  hide-on-click-modal
                />
              </div>
            </div>
          </div>
        </div>
        <div style="width: 83%; display: flex; height: 110px; flex-wrap: wrap">
          <div style="width: 18%; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              style="margin-left: 10px"
              @inputDBclick="inputDBclick"
              :OriginalFilter="{ static: true }"
              :searchImg="false"
              :formList="formListLeft"
              @findClicked="findClicked"
            />
          </div>
          <div style="width: 70%; margin-left: 10px; border-radius: 0px 0px 0px 0px; border: 1px solid #dcdfe6">
            <Find
              style="margin-left: 10px"
              @Launchform="Launchform30"
              :OriginalFilter="{ static: true }"
              :searchImg="false"
              :formList="formList2"
              @findClicked="findClicked1"
            />
          </div>
          <div style="width: 100%" class="mt24">
            <el-card shadow="never" :body-style="{ padding: '5px' }">
              <div style="display: flex">
                <div style="width: 100%">
                  <div slot="header" class="f16">
                    <span style="font-weight: 600; margin-bottom: 15px">型体颜色材料输入</span>
                  </div>
                  <HeTable
                    v-if="purFlagList"
                    :showToolTip="false"
                    @toBottom="toBottom"
                    @toUp="toUp"
                    @inputChange="inputChange20"
                    @emitSelectValue="selectValChange"
                    @selectListShow="selectListShow"
                    @selectList="selectedList"
                    :selection="true"
                    :isLoading="loading"
                    :tableHeader="tableHeader3"
                    :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
                    :TableHeight="95"
                    :outTableHeight="90"
                    @currentRow="currentRow3"
                    @currentRow1="currentRow20"
                  />

                  <Table
                  v-else
                    :showToolTip="false"
                    @toBottom="toBottom"
                    @toUp="toUp"
                    @inputChange="inputChange20"
                    @emitSelectValue="selectValChange"
                    @selectListShow="selectListShow"
                    @selectList="selectedList"
                    :selection="true"
                    :isLoading="loading"
                    :tableHeader="tableHeader3"
                    :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
                    :TableHeight="95"
                    :outTableHeight="90"
                    @currentRow="currentRow3"
                    @currentRow1="currentRow20"
                  />

                  <!-- <div style="margin-top: 10px;" slot="header" class="f16">
                  <span style="font-weight: 600;">贴合子材料明细</span>
                </div>
                <Table @inputChange="confirmChange10" @checkboxChange="change10" :isLoading='loading1' :tableHeader="tableHeader5"
                  :tableData="LaminatedSubmaterialMethodsTableDateLsit" :TableHeight="29" :outTableHeight="80" /> -->
                </div>
              </div>
            </el-card>
          </div>
        </div>
      </div>
    </el-card>

    <!-- <div style="width: 15%" class="mt24">
      <el-card shadow="never" :body-style="{ padding: '5px' }">
        <div slot="header" class="f16">
          <span style="font-weight: 600">选择型体</span>
        </div>
        <Table
          @currentRow="currentRow1"
          :tableHeader="tableHeader"
          :tableData="TypeQueryMethodsTableDateList"
          :TableHeight="50"
          :outTableHeight="150"
          :isLoading="isLoading11"
        />
        <PageModule
          :PageData="{ total: totalTk, buttonS: true, pageSizeShow: true }"
          :layout="'prev, pager'"
          @pageSizeChange="handleSizeChangeTk"
          @pageChange="handleCurrentChangeTk"
        />
      </el-card>
      <el-card style="height: 100%" shadow="never" :body-style="{ padding: '5px' }">
        <div slot="header" class="f16">
          <span style="font-weight: 600"></span>
        </div>
        <Table
          @currentRow="currentRow2"
          :tableHeader="tableHeader2"
          :tableData="ColorCodePictureMethodsParmsTableDateList.list"
          :TableHeight="50"
          :outTableHeight="150"
        />
        <PageModule
          :PageData="{ total: total, buttonS: true, pageSizeShow: true }"
          :layout="'prev, pager'"
          @pageSizeChange="handleSizeChange"
          @pageChange="handleCurrentChange"
        />
      </el-card>
    </div>
    <div style="width: 85%" class="mt24">
      <el-card shadow="never" :body-style="{ padding: '5px' }">
        <div style="display: flex">
          <div style="width: 100%">
            <div slot="header" class="f16">
              <span style="font-weight: 600; margin-bottom: 15px">型体颜色材料输入</span>
            </div>
            <HeTable
              v-if="purFlagList"
              @toBottom="toBottom"
              @toUp="toUp"
              @inputChange="inputChange20"
              @emitSelectValue="selectValChange"
              @selectListShow="selectListShow"
              @selectList="selectedList"
              :selection="true"
              :isLoading="loading"
              :tableHeader="tableHeader3"
              :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
              :TableHeight="70"
              :outTableHeight="80"
              @currentRow="currentRow3"
              @currentRow1="currentRow20"
            />

            <Table
              v-else
              @toBottom="toBottom"
              @toUp="toUp"
              @inputChange="inputChange20"
              @emitSelectValue="selectValChange"
              @selectListShow="selectListShow"
              @selectList="selectedList"
              :selection="true"
              :isLoading="loading"
              :tableHeader="tableHeader3"
              :tableData="TypeColorDataQueryMethodsInterfaceTableDateList"
              :TableHeight="70"
              :outTableHeight="80"
              @currentRow="currentRow3"
              @currentRow1="currentRow20"
            />

            <div style="margin-top: 10px" slot="header" class="f16">
              <span style="font-weight: 600">贴合子材料明细</span>
            </div>
            <Table
              @inputChange="confirmChange10"
              @checkboxChange="change10"
              :isLoading="loading1"
              :tableHeader="tableHeader5"
              :tableData="LaminatedSubmaterialMethodsTableDateLsit"
              :TableHeight="29"
              :outTableHeight="80"
            />
          </div>
        </div>
      </el-card>
    </div> -->

    <!-- 选择材料 -->
    <el-dialog v-model="dialogVisible2" title="选择材料" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList6" @Launchform="Launchform7" @findClicked="findClicked6" />
      <h1 style="color: red">正式材料</h1>
      <Table
        @currentRow="currentRow7"
        :tableHeader="tableHeader12"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.officialMaterials.adhesiveMaterialList"
        :TableHeight="40"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalExploit, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeExploit"
        @pageChange="handleCurrentChangeExploit"
      />
      <div style="margin: auto; width: 20%">
        <el-button type="primary" size="default" @click="SelectTheCurrentRowToInsertMethods">选择当前行正式材料到用量表</el-button>
      </div>

      <h1 style="color: red">开发材料</h1>
      <Table
        @currentRow1="currentRow8"
        :tableHeader="tableHeader13"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.developmentMaterials.developmentMaterialsList"
        :TableHeight="40"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalofficial, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeofficial"
        @pageChange="handleCurrentChangeofficial"
      />
      <div style="margin: auto; width: 20%">
        <el-button type="primary" size="default" @click="ProductionOfOfficialMaterialsMethods">生产正式材料并选择到用量表</el-button>
      </div>
      <div style="width: 30%; display: flex; margin-top: 30px">
        <p>
          <el-form-item label="材料名称" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
            <el-input
              type="textarea"
              :disabled="true"
              v-model="ProductionOfOfficialMaterialsMethodsParms.mtlName"
              style="width: 410px; height: 40px; margin-top: 5px"
            />
          </el-form-item>
        </p>

        <div style="margin-left: 50px; margin-top: -30px">
          <el-form-item label="材料颜色" style="font-size: 15px; height: 40px; align-items: center; margin-left: -10px">
            <el-input
              @dblclick="dbClickListColor"
              v-model="ProductionOfOfficialMaterialsMethodsParms.mtlColor"
              style="width: 400px; height: 40px; margin-top: 5px"
            />
          </el-form-item>
          <div style="display: flex">
            <el-form-item label="规格" style="font-size: 15px; height: 40px; align-items: center; margin-left: -10px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.mtlSpec"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>

            <el-form-item label="单位" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.mtlUnit"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>

            <el-form-item label="供应商" style="font-size: 15px; height: 40px; align-items: center; margin-left: 20px">
              <el-input
                :disabled="true"
                v-model="ProductionOfOfficialMaterialsMethodsParms.vendor"
                style="width: 80px; height: 40px; margin-top: 5px; margin-right: -10px"
              />
            </el-form-item>
          </div>
        </div>
      </div>
    </el-dialog>

    <el-drawer v-model="drawer3" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer3 = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <h1>查询条件</h1>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList3" @Launchform="Launchform5" @findClicked="findClicked10" />
      <div style="display: flex; margin-top: 10px">
        <div style="width: 90%">
          <h1>型体颜色BOM查询</h1>
          <Table
            @currentRow="currentRow5"
            :tableHeader="tableHeader8"
            :tableData="UsageDetailQueryMethodsTableDateList.list"
            :TableHeight="100"
            :outTableHeight="80"
          />
          <PageModule
            :PageData="{ total: totalList, buttonS: true, pageSizeShow: true }"
            @pageSizeChange="handleSizeChangeList"
            @pageChange="handleCurrentChangeList"
          />
        </div>
        <div style="width: 10%; margin-left: 10px">
          <h1>全码用量资料</h1>
          <Table :tableHeader="tableHeader9" :tableData="AllListMethodsTableDateList" :TableHeight="100" :outTableHeight="80" />
        </div>
      </div>
    </el-drawer>

    <el-drawer v-model="drawer5" :direction="'ttb'" size="small" :with-header="false">
      <Table :tableHeader="tableHeader10" :tableData="UsageChangeQueryMethodsTableDateList.list" :TableHeight="100" :outTableHeight="80" />
      <PageModule
        :PageData="{ total: totalA, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeA"
        @pageChange="handleCurrentChangeA"
      />
    </el-drawer>

    <!-- 复制资料 -->
    <el-dialog v-model="dialogVisible1" title="复制资料" width="50%" class="dialog pb0">
      <div style="display: flex">
        <div style="width: 30%">
          <el-form-item label="原型体" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input v-model="CopyDataMethodsPamrs.styleNo" style="width: 200px; height: 40px; margin-top: 5px" :disabled="true" />
          </el-form-item>

          <el-form-item label="原颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input v-model="CopyDataMethodsPamrs.styleColor" style="width: 100px; height: 40px; margin-top: 5px" :disabled="true" />
          </el-form-item>

          <el-form-item label="订单号" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: -10px">
            <el-input
              v-model="CopyDataMethodsPamrs.orderId"
              style="width: 230px; height: 40px; margin-top: 5px; margin-right: -10px"
              :disabled="true"
            />
          </el-form-item>
        </div>

        <div style="width: 30%; margin-left: 100px">
          <el-form-item label="新型体" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input @dblclick="doubeList" v-model="CopyDataMethodsPamrs.newStyleNo" style="width: 200px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="新颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 20px">
            <el-input @dblclick="inputDBclick1" v-model="CopyDataMethodsPamrs.newStyleColor" style="width: 100px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="订单号" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: -10px">
            <el-input v-model="CopyDataMethodsPamrs.newOrderId" style="width: 230px; height: 40px; margin-top: 5px; margin-right: -10px" />
          </el-form-item>
        </div>

        <div style="width: 5%; margin-left: 30px">
          <el-radio-group style="display: flex" v-model="CopyDataMethodsPamrs.wantColor">
            <el-radio label="0" size="large">要颜色</el-radio>
            <el-radio label="1" size="large">不要颜色</el-radio>
          </el-radio-group>
        </div>
      </div>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" @findClicked="findClicked5" :formList="formList5" @Launchform="Launchform" />
    </el-dialog>

    <!-- 颜色弹框 -->
    <el-drawer v-model="drawer" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList7" @Launchform="Launchform8" @findClicked="findData1" />
      <h5 style="font-size: 16px; margin-top: 12px">颜色明细</h5>
      <Table
        style="width: 60%"
        :tableData="ColorAcquisitionTableDateList.colorSystemList"
        :tableHeader="tableHeader15"
        :TableHeight="80"
        :isLoading="isLoading3"
        @currentRow1="currentRowToclk"
      />
      <PageModule
        style="width: 60%"
        :PageData="{ buttonS: true, total: totalKlt, pageSizeShow: true }"
        @pageChange="handleSizeChange2"
        @pageSizeChange="handleCurrentChange2"
      />
    </el-drawer>

    <!-- 贴合材料处理 -->
    <el-dialog v-model="dialogVisible3" title="选择材料" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList10" @findClicked="findData" @Launchform="Launchform11" />
      <div>
        <h1>贴合材料建档</h1>
        <Table
          @inputChange="confirmChange5"
          @currentRow="currentRow"
          :isLoading="isLoading2"
          :tableHeader="tableHeader17"
          :tableData="MethodOfBondingMaterialTableDateList"
          :TableHeight="30"
          :outTableHeight="210"
          @currentRow1="currentRow15"
        />

        <div style="display: flex">
          <el-form-item label="材料名称" style="font-size: 15px; height: 40px; display: flex; align-items: center">
            <el-tooltip :content="InputDateList.input1" placement="top">
              <el-input v-model="InputDateList.input1" style="width: 303px; height: 40px; margin-top: 5px" :disabled="true" />
            </el-tooltip>
          </el-form-item>

          <el-form-item label="材料颜色" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 10px">
            <el-tooltip :content="InputDateList.input2" placement="top">
              <el-input v-model="InputDateList.input2" style="width: 100px; height: 40px; margin-top: 5px" :disabled="true" />
            </el-tooltip>
          </el-form-item>

          <el-form-item label="规格" style="font-size: 15px; height: 40px; display: flex; align-items: center; margin-left: 10px">
            <el-input v-model="InputDateList.input3" style="width: 100px; height: 40px; margin-top: 5px" />
          </el-form-item>

          <el-form-item label="单位" style="font-size: 15px; height: 15px; margin-left: 30px; margin-top: 5px">
            <el-select v-model="InputDateList.input4" class="m-2" placeholder="选择框" size="large">
              <el-option v-for="item in options" :key="item.mtlUnit" :label="item.mtlUnit" :value="item.mtlUnit" />
            </el-select>
          </el-form-item>
        </div>
      </div>

      <h1 style="color: red">正式材料</h1>
      <Table
        @currentRow="currentRow18"
        @currentRow1="currentRow17"
        :tableHeader="tableHeader12"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.officialMaterials.adhesiveMaterialList"
        :TableHeight="30"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalExploit, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeExploit"
        @pageChange="handleCurrentChangeExploit"
      />

      <h1 style="color: red">开发材料</h1>
      <Table
        @currentRow="currentRow18"
        @currentRow1="currentRow17"
        :tableHeader="tableHeader13"
        :tableData="FormalMaterialsAndMethodsForDevelopingTableDateList.developmentMaterials.developmentMaterialsList"
        :TableHeight="30"
        :outTableHeight="230"
      />
      <PageModule
        :PageData="{ total: totalofficial, buttonS: true, pageSizeShow: true }"
        @pageSizeChange="handleSizeChangeofficial"
        @pageChange="handleCurrentChangeofficial"
      />
    </el-dialog>

    <!-- 复制用量 -->
    <el-dialog v-model="dialogVisible5" title="选择材料" width="30%" class="dialog pb0">
      <div>
        <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList8" @Launchform="Launchform10" />
        <div style="width: 70%; margin-top: 20px">
          <Table
            @selectList="selectedList12"
            :selection="true"
            :tableHeader="tableHeader16"
            :tableData="ReplicationVolumeQueryTableDateList.list"
            :TableHeight="40"
            :outTableHeight="230"
          />
          <PageModule
            :PageData="{ total: totalActiveList, buttonS: true, pageSizeShow: true }"
            :layout="'prev, pager'"
            @pageSizeChange="handleSizeChangeTkList"
            @pageChange="handleCurrentChangeTkList"
          />
        </div>
        <h1 style="color: #0000ff">把当前型体颜色用量复制到以以上打勾型体颜色</h1>
        <div style="width: 30px; margin: auto; margin-top: 20px">
          <el-button type="primary" size="default" @click="ReplicationDosageMethods">复制</el-button>
        </div>
      </div>
    </el-dialog>

    <!-- 取型体弹窗 -->
    <el-drawer v-model="drawer10" :direction="'ttb'" size="small" :with-header="false">
      <span @click="drawer10 = false" style="float: right; cursor: pointer; color: rgb(7, 7, 7)">X</span>
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList7" @Launchform="Launchform8" @findClicked="findData1" />
      <h5 style="font-size: 16px; margin-top: 12px">颜色明细</h5>
      <Table
        style="width: 60%"
        :tableData="ColorAcquisitionTableDateList.colorSystemList"
        :tableHeader="tableHeader15"
        :TableHeight="80"
        :isLoading="isLoading3"
        @currentRow1="currentRowToclk15"
      />
      <PageModule
        style="width: 60%"
        :PageData="{ buttonS: true, total: totalKlt, pageSizeShow: true }"
        @pageChange="handleSizeChange2"
        @pageSizeChange="handleCurrentChange2"
      />
    </el-drawer>

    <el-dialog v-model="dialogVisible" :direction="'ttb'" size="small" :with-header="false">
      <Table class="widthInputTable" :tableData="PrecautionsFileMethodsParmsDateList" :tableHeader="tableHeader19" :TableHeight="110" />
      <div style="margin: auto; width: 55px">
        <el-button type="primary" size="default" @click="inputChange">保存</el-button>
      </div>
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog v-model="AllSizeNo" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <el-button type="primary" size="default" @click="addSize">增加全码用量资料</el-button>
      <el-button type="primary" size="default" @click="deleteSizeNo">删除全码用量</el-button>
      <el-button type="primary" size="default" @click="ubdatesizeNo">更新全码用量</el-button>

      <div style="width: 80%; margin-left: 5px; margin: auto; margin-top: 15px">
        <div slot="header" class="f16">
          <span style="font-weight: 600">全码用量资料</span>
        </div>
        <Table
          @currentRow="currentRow10"
          :isLoading="loading2"
          :tableHeader="tableHeader7"
          :tableData="FullCodeUsageDataMethodsTableDateLsit"
          :TableHeight="100"
          :outTableHeight="80"
        />
      </div>
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog v-model="AllSizeNo1" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList15" @Launchform="Launchform20" @findClicked="findClicked20" />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog v-model="AllSizeNo12" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow25"
        :isLoading="loading2"
        :tableHeader="tableHeaderStyleNo"
        :tableData="FullCodeUsageDataMethodsTableDateLsi1t"
        :TableHeight="100"
        :outTableHeight="80"
      />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog v-model="AllSizeNo123" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow30"
        :tableHeader="tableHeader"
        :tableData="TypeQueryMethodsTableDateList"
        :TableHeight="50"
        :outTableHeight="150"
        :isLoading="isLoading11"
      />
    </el-dialog>

    <!-- 全码用量资料明细 -->
    <el-dialog v-model="AllSizeNo125" :direction="'ttb'" size="small" :with-header="false" width="30%">
      <Table
        @currentRow1="currentRow26"
        :isLoading="loading2"
        :tableHeader="tableHeaderStyleNo1"
        :tableData="FullCodeUsageDataMethodsTableDateLsi1t1"
        :TableHeight="100"
        :outTableHeight="80"
      />
    </el-dialog>
  </div>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref, onUnmounted, watch } from 'vue'
import { GetVendorList, type GetVendorListListParms } from '@/api/WarehouseDepartment/FactoryStorage/InputInsoleReceivingIssuingMaterials'
import { VendorData } from '@/api/WarehouseDepartment/FactoryStorage/TemporaryReceiptStorage'
import {
  UnitDefinition,
  type FitProcessingMethodInterface,
  FitProcessingMethod
} from '@/api/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
import fileRequest from '@/utils/fileRequest'
import { ColorCodeUpdate } from '@/api/ControlDepartment/MaterialManagement/BulkQuantityFile'
import JMessage from '@/utils/JMessage'
export default defineComponent({
  name: 'ResearchAndDevelopmentVolumeDocumentation1'
})
</script>
<script lang="ts" setup>
import { i18n, Jzhcn } from '@/i18n'
import {
  BasicNumber,
  deleteCofficial,
  partNameQuery,
  copyData,
  selectMtlName,
  BondingMaterialTreatment,
  styleColorQuery,
  InsertTheBondingMaterial,
  ProductionOfOfficialMaterials,
  SelectTheCurrentRowToInsert,
  UpdateFullCodeUsage,
  DeleteTheCheckmarkedRecordType,
  CopyData,
  PrecautionsFileList,
  PrecautionsFile,
  UsageChangeQuery,
  UsageDetailQuery,
  FullCodeUsageCheck,
  saveDateList,
  FullCodeUsageData,
  LaminatedSubmaterial,
  TypeColorDataQuery,
  TypeQuery,
  ColorCodePicture,
  PositionDetailQuery
} from '@/api/ControlDepartment/MaterialManagement/ResearchAndDevelopmentVolumeDocumentation1'
import type {
  InsertTheBondingMaterialParms,
  ProductionOfOfficialMaterialsParms,
  SelectTheCurrentRowToInsertParms,
  UpdateFullCodeUsagePamrs,
  DeleteTheCheckmarkedRecordTypePamrs,
  CopyDataParms,
  UsageChangeQueryInterface,
  UsageChangeQueryparms,
  UsageDetailQueryPamrsList,
  UsageDetailQueryParmsList,
  saveDateListParms,
  FullCodeUsageDataParms,
  LaminatedSubmaterialInterface,
  PositionDetailQueryPamrs,
  TypeColorDataQueryInterface,
  TypeColorDataQueryParms,
  TypeQueryParms,
  ColorCodePictureTableDate,
  ColorCodePictureParms
} from '@/api/ControlDepartment/MaterialManagement/ResearchAndDevelopmentVolumeDocumentation'
import {
  InsertTheBondingMaterialList1,
  InsertTheBondingMaterialList,
  ListOfFitAddList,
  colourCcheme,
  chooseAColor,
  FormalMaterialsAndDevelopmentMaterials,
  ListOfFitMaterials,
  FitMaterialProfileDeleted,
  ObtainVendor,
  Fluctuation,
  TheCompositeMaterialIsFormed,
  LaminatedMaterialFile
} from '@/api/ControlDepartment/MaterialManagement/LaminatedMaterialFile'
import type {
  ListOfFitAddListInterface,
  chooseAColorInterface,
  chooseAColorParms,
  FormalMaterialsAndDevelopmentMaterialsParms,
  FormalMaterialsAndDevelopmentMaterialsInterface,
  ListOfFitMaterialsInterface
} from '@/api/ControlDepartment/MaterialManagement/LaminatedMaterialFile'
import LoginWork from '@/utils/LoginWork'
import { ElMessage } from 'element-plus'
import { ElMessageBox } from 'element-plus'
import { classifyQuery } from '@/api/WarehouseDepartment/FactoryStorage/FitOutsourcingProcessing'
import { useRouter } from 'vue-router'

// 修改基本号

const Launchform30 = (row: any) => {
  ubdateSizeNoMethodsParms.value.baseSize = row[11].inputValue
}
const ubdateSizeNoMethodsParms = ref<any>({
  baseSize: '',
  styleColor: '',
  styleColorMaterialRequests: [],
  styleColorRemark: '',
  styleNo: ''
})

const ubdateSizeNoMethods = async () => {
  ubdateSizeNoMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await BasicNumber(ubdateSizeNoMethodsParms.value)
  if (result.code === 200) {
    ColorCodePictureMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const image = ref('')

const toUp = async (event: any, rowIndex: number, row: any, row1: any, prop: any) => {
  // 直接使用 rowIndex 获取元素
  ColorMtl.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlColor
  confirmChange20TableDate.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  currentTableRow.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  mtlNameSpace.value.mtlName = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlName
  mtlNameSpace.value.mtlSpec = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlSpec
  mtlNameSpace.value.mtlUnit = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlUnit
  tableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1]
  mtlNoAny.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex + 1].mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = TypeColorDataQueryMethodsInterfaceTableDateList.value[
    rowIndex + 1
  ] as any
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  const result = await selectMtlName(mtlNameSpace.value)
  if (result !== null) {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = result.mtlColor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ColorMtl.value
  } else {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment

  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
  InsertTheBondingMaterialMethodsListAParms.value.partName = partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = segment
  InsertTheBondingMaterialMethodsListAParms.value.seqNo = seqNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor

  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  //
  BondingMaterialTreatmentParms.value.vendor = vendor

  if (prop === 'usage') {
    const element = row.data[rowIndex + 1]

    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'partName') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'mtlNo') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size1') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size2') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex + 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  }
}

const toBottom = async (event: any, rowIndex: any, row: any, row1: any, prop: any) => {
  // 直接使用 rowIndex 获取元素
  ColorMtl.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlColor
  confirmChange20TableDate.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  currentTableRow.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  mtlNameSpace.value.mtlName = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlName
  mtlNameSpace.value.mtlSpec = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlSpec
  mtlNameSpace.value.mtlUnit = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlUnit
  tableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1]
  mtlNoAny.value = TypeColorDataQueryMethodsInterfaceTableDateList.value[rowIndex - 1].mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = TypeColorDataQueryMethodsInterfaceTableDateList.value[
    rowIndex - 1
  ] as any
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  const result = await selectMtlName(mtlNameSpace.value)
  if (result !== null) {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = result.mtlColor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ColorMtl.value
  } else {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment

  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
  InsertTheBondingMaterialMethodsListAParms.value.partName = partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = segment
  InsertTheBondingMaterialMethodsListAParms.value.seqNo = seqNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor

  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  //
  BondingMaterialTreatmentParms.value.vendor = vendor
  if (prop === 'usage') {
    // 计算下一个行索引
    const nextRowIndex = rowIndex + 1

    // 确保下一个索引在范围内
    // 通过 v-for 中的 :ref 属性获取下一个输入框
    const nextInput = document.getElementById(`input-${rowIndex - 1}`)
    if (nextInput) {
      ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
      ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
    }
  } else if (prop === 'partName') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'mtlNo') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size1') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  } else if (prop === 'size2') {
    const element = row.data[rowIndex + 1]
    if (element) {
      // 计算下一个行索引
      const nextRowIndex = rowIndex + 1

      // 确保下一个索引在范围内
      if (nextRowIndex < TypeColorDataQueryMethodsInterfaceTableDateList.value.length) {
        // 通过 v-for 中的 :ref 属性获取下一个输入框
        const nextInput = document.getElementById(`input-${prop}${rowIndex - 1}`)
        if (nextInput) {
          ;(nextInput as HTMLInputElement).focus() // 将焦点设置到下一个输入框
          ;(nextInput as HTMLInputElement).select() // 选中输入框中的值
        }
      } else {
      }
    } else {
    }
  }
}

const inputChange25 = (row: any) => {}

const LaminatedMaterialFileMethods = async () => {
  const result = await LaminatedMaterialFile(
    MethodOfBondingMaterialTableDateList.value?.map((item: any) => {
      item.prdType = item.prdType.selectValue
      item.vendor = item.vendor.selectValue.split(' ')[1]
      item.purFlag = item.purFlag === true ? 'Y' : ''
      return item
    })
  )
  if (result.code === 200) {
    MethodOfBondingMaterial()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 删除正式材料
const deleteCofficialMethodsParms = ref('')

const handleCloseMateriaLKlc12 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      deleteCofficialMethods()
    })
    .catch(() => {})
}

const deleteCofficialMethods = async () => {
  try {
    const result = await deleteCofficial(deleteCofficialMethodsParms.value)
    if (result.code === 200) {
      FormalMaterialsAndMethodsForDevelopingMaterials()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  } catch (error) {
    JMessage.warning('删除失败请重试')
  }
}

const ColorMtl = ref('')

const AllSizeNo125 = ref(false)

const inputDBclick1 = (row?: any) => {
  if (CopyDataMethodsPamrs.value.newStyleNo === '') {
    JMessage.warning('查询颜色名称型体不可为空')
  } else {
    CopyDataMethodsPamrsStyle.value.styleNo = CopyDataMethodsPamrs.value.newStyleNo
    AllSizeNo125.value = true
    styleColorQueryMethods1()
  }
}

const ColorCodePictureMethodsParms1 = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodePictureMethods1 = async () => {
  const result = await ColorCodePicture(ColorCodePictureMethodsParms1.value)
  FullCodeUsageDataMethodsTableDateLsi1t1.value = result.list
}

const FullCodeUsageDataMethodsTableDateLsi1t1 = ref([])

const CopyDataMethodsPamrsStyle = ref({
  styleNo: ''
})

const styleColorQueryMethods1 = async () => {
  try {
    const result = await styleColorQuery(CopyDataMethodsPamrsStyle.value)
    console.log(1)
    FullCodeUsageDataMethodsTableDateLsi1t1.value = result.list
  } catch (error) {
    JMessage.error('颜色名称代号查询出错')
  }
}

const currentRow26 = (row: any) => {
  AllSizeNo125.value = false
  CopyDataMethodsPamrs.value.newStyleColor = row.styleColor
  CopyDataMethodsPamrs.value.newOrderId = row.orderId
}

const inputBlur = async (e: any) => {
  if (isListTav.value) {
    const colorParam = encodeURIComponent(ProductionOfOfficialMaterialsMethodsParms.value.mtlColor)
    const result1 = await LoginWork.get<any, any>(`/ColorAttribute/getYfColorDetail?color=${colorParam}`)
    if (result1.data === null) {
      ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ''
      JMessage.error(`该颜色不存在不可修改`)
    } else {
      ProductionOfOfficialMaterialsMethodsParms.value.colorCode = result1.data.colorCode
    }
  }
}

const isListTav = ref(true)

onUnmounted(() => {
  if (purFlagList.value) {
    handleCloseMateriaLKlc15()
  }
})

const handleCloseMateriaLKlc15 = (_done?: () => void) => {
  ElMessageBox.confirm('是否要保存数据?')
    .then(async () => {
      saveDateListMethods()
    })
    .catch(() => {})
}

const doubeList = () => {
  AllSizeNo123.value = true
}

const currentRow30 = (row: any) => {
  CopyDataMethodsPamrs.value.newStyleNo = row.style
  ColorCodePictureMethodsParms1.value.styleNo = row.style
  AllSizeNo123.value = false
}

const AllSizeNo123 = ref(false)

// 贴合材料处理还原
const BondingMaterialTreatmentParms = ref({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: '',
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: '',
  orderId: '',
  colorCopyTemp: '',
  orderIdCopyTemp: '',
  styleCopyTemp: ''
})

const BondingMaterialTreatmentMethods = async () => {
  BondingMaterialTreatmentParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  try {
    const result = await BondingMaterialTreatment(BondingMaterialTreatmentParms.value)
  } catch (error) {
    JMessage.error('还原材料异常')
  }
}

const mtlNoAny = ref('')

const inputChange20 = (row: any, blum: any) => {
  if (blum === '部位   ') {
    PositionDetailQueryMethodsParms.value.partName = row.partName
    partNameQueryMehtods(row.partName, row)
    return
  }
  if (blum === 'Table.materialCode' && row.mtlNo !== '') {
    copyDataParms.value.mtlNo = row.mtlNo
    copyDataParms.value.partName = row.partName
    copyDataParms.value.seqNo = row.seqNo
    copyDataParms.value.segment = row.segment
    vendorList.value = row.vendor
    if (copyDataParms.value.partName === '') {
      JMessage.warning('复制时部位不可为空')
      return
    }
    copyDataMethods(row)
    return
  }

  if (row.mtlNo === '') {
    for (const key in row) {
      if (
        key !== 'seqNo' &&
        key !== 'partName' &&
        key !== 'segment' &&
        key !== 'usage' &&
        key !== 'usageType' &&
        key !== 'sizeType' &&
        key !== 'drawDept' &&
        key !== 'mtlProperty'
      ) {
        // 排除 seqNo 和 partName
        row[key] = '' // 将其他属性设置为空字符串
      }
    }
    row.change = 'Y'
    row.disableConfirm = true
    return
  }
}

const copyDataMethods = async (row: any) => {
  row.mtlNo = row.mtlNo.trim()
  copyDataParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await copyData(copyDataParms.value)
  if (result.code === 200) {
    row.mtlNo = result.data.mtlNo
    row.mtlName = result.data.mtlName
    row.mtlColor = result.data.mtlColor
    row.mtlSpec = result.data.mtlSpec
    row.size1 = result.data.size1
    row.size2 = result.data.size2
    row.mtlUnit = result.data.mtlUnit
    row.vendor = result.data.vendor

    row.drawDept.selectValue = result.data.drawDept
    row.mtlProperty.selectValue = result.data.mtlProperty
    row.usageType.selectValue = result.data.usageType
  } else {
    JMessage.error(result.message)
  }
}

const partNameQueryMehtods = async (partName: string, row: any) => {
  const result = await partNameQuery(partName)
  if (result.message === null) {
    JMessage.error('暂无该部位')
    row.partName = ''
    return
  }
}

const copyDataParms = ref({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: '',
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: '',
  orderId: ''
})

const confirmChange20TableDate = ref<any>()

const confirmChange20 = (row: any) => {}

// 双击事件查询颜色代号
const currentRow25 = (row: any) => {
  formList1.value[1].inputValue = row.styleColor
  formList1.value[2].inputValue = row.orderId
  ColorCodePictureMethodsParms.value.styleColor = row.styleColor
  ColorCodePictureMethodsParms.value.colorCode = row.colorCode
  AllSizeNo12.value = false
}

const inputDBclick = (row: any) => {
  if (formList1.value[0].inputValue === '') {
    JMessage.warning('查询颜色名称型体不可为空')
  } else {
    AllSizeNo12.value = true
    styleColorQueryParms.value.styleNo = formList1.value[0].inputValue
    styleColorQueryMethods()
  }
}

const FullCodeUsageDataMethodsTableDateLsi1t = ref([])

const AllSizeNo12 = ref(false)

// 型体配色查询
const styleColorQueryParms = ref<any>({
  styleNo: ''
})

const styleColorQueryMethods = async () => {
  try {
    const result = await styleColorQuery(styleColorQueryParms.value)
    FullCodeUsageDataMethodsTableDateLsi1t.value = result.list
  } catch (error) {
    JMessage.error('颜色名称代号查询出错')
  }
}

// 序号变更
const AllSizeNo1 = ref(false)

const AllSizeNo13 = ref()

const newSeqNo = ref()

const Launchform20 = (row: any) => {
  newSeqNo.value = row[1].inputValue
}

// 增加明细资料
const TypeColorDataQueryMethodsInterfaceTableDateList = ref<TypeColorDataQueryInterface[]>([])

const findClicked20 = (row: any) => {
  if (row === '确认调整') {
    if (newSeqNo.value === '') {
      JMessage.warning('新序号不可为空')
      return
    }

    const sourceIndex = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === formList15.value[0].inputValue)

    const targetIndex = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === newSeqNo.value)

    if (sourceIndex !== -1 && targetIndex !== -1) {
      const sourceElement = TypeColorDataQueryMethodsInterfaceTableDateList.value[sourceIndex]

      let newDetailData = {
        ...sourceElement,
        seqNo: newSeqNo.value // 新元素的 seqNo 设置为目标元素的 seqNo
      }

      TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(sourceIndex, 1)

      const insertIndex = targetIndex
      TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(insertIndex, 0, newDetailData)

      // 更新 seqNo
      for (let i = 0; i < TypeColorDataQueryMethodsInterfaceTableDateList.value.length; i++) {
        TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo = String(i + 1)
      }

      AllSizeNo1.value = false
    } else {
      JMessage.warning('找不到指定的序号元素')
    }
  }
}

const formList15 = ref([
  {
    type: 'input1',
    inputValue: '',
    inputPlaceholder: '旧序号',
    inputDisabled: true
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '新序号'
  },
  {
    type: 'button',
    checkboxLabel: '确认调整'
  }
])

const currentRow20 = (row: any, cloum: string) => {
  if (cloum === 'seqNo') {
    AllSizeNo1.value = true
  }

  formList15.value[0].inputValue = row.seqNo
  AllSizeNo13.value = row.seqNo
  formList15.value[1].inputValue = ''
}

const selectValChange = (row: any, bull: any) => {
  bull.partName = row
  PositionDetailQueryMethodsParms.value.partName = row
  PositionDetailQueryMehtods(bull)
}

// 全码用量资料
const AllSizeNo = ref(false)

const formList = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体查询'
  }
])

// 增加全码用量
const addSize = () => {
  FullCodeUsageDataMethodsTableDateLsit.value.push({ sizeFrom: '', mtlUsage: '', change: 'Y', disableConfirm: 'true' })
}

// 删除全码用量
const deleteSizeNo = () => {
  if (listValueDate.value.length === 0) {
    JMessage.warning('请选择需要删除全码用量数据')
  } else {
    handleCloseMateriaLKlcLtvCodeUsage()
  }
}

const ubdatesizeNo = () => {
  UpdateFullCodeUsageMethods()
}

const formList1 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体查询'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '颜色名称'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '订单号'
  },
  {
    type: 'button',
    checkboxLabel: '查询'
  },
  {
    type: 'button',
    checkboxLabel: '新增'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
  // {
  //   type: 'button',
  //   checkboxLabel: '保存',bgColor:'#1890FF',
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '检核',
  //   bgColor:'#1890FF',
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '取消检核',
  //   bgColor:'#1890FF',
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '颜色代码更新',
  // },
])

const formListLeft = ref([
  // {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '型体查询',
  //   },
  //   {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '颜色名称',
  //   },
  //   {
  //     type: 'input',
  //     inputValue: '',
  //     inputPlaceholder: '颜色代号',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '查询',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '新增',
  //   },
  //   {
  //     type: 'button',
  //     checkboxLabel: '置空',bgColor:'#1890FF',
  //   },
  {
    type: 'button',
    checkboxLabel: '保存',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '检核',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '取消检核',
    bgColor: '#1890FF',
    buttonWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '颜色代码更新',
    buttonWidth: '90px'
  }
])

const formList2 = ref([
  {
    type: 'button',
    checkboxLabel: '增加明细资料',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '注意事项建档',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '复制资料',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '删除打勾记录',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: 'BOM表导出',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '用量明细查询',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '重排序号',
    buttonWidth: '100px'
  },
  {
    type: 'button',
    checkboxLabel: '整单型体颜色删除',
    buttonWidth: '120px'
  },
  {
    type: 'button',
    checkboxLabel: '选择材料',
    bgColor: '#1890FF',
    buttonWidth: '110px'
  },
  {
    type: 'button',
    checkboxLabel: '贴合材料处理',
    bgColor: '#1890FF',
    buttonWidth: '100px'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '复制用量',
  //   buttonWidth:'120px'
  // },
  {
    type: 'button',
    checkboxLabel: '用量变更查询',
    buttonWidth: '110px'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '全码用量资料明细',
  //   buttonWidth:'120px'
  // },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '基本号码',
    inputWidth: '90px'
  },
  {
    type: 'button',
    checkboxLabel: '保存修改基本号码',
    buttonWidth: '120px'
  }
])

const formList3 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '部位'
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '分类',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
])

const formList5 = ref([
  {
    type: 'button',
    checkboxLabel: '保存'
  }
])

const formList6 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '编码'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称1'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称2'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称3'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '供应商'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '转面材材料建档'
  },
  {
    type: 'button',
    checkboxLabel: '转成型材料建档'
  },
  {
    type: 'button',
    checkboxLabel: '删除正式材料'
  }
])

const formList7 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '色系',
    selectOptions: []
  },
  {
    type: 'input',
    inputPlaceholder: '颜色',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: 'PANTONE',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '颜色(英)',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '搜索',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },

  {
    type: 'button',
    checkboxLabel: '颜色定义'
  }
])

const formList8 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '型体'
  }
])

const formList9 = ref([
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '序号',
    inputDisabled: true
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '部位',
    selectOptions: []
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '分段'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '物料编码'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料颜色'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '材料名称'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '规格'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '单位'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '尺码起'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '尺码止'
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '用量'
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '计算方式',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '领用单位',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '号码类型',
    selectOptions: []
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '主辅料',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '保存'
  }
])

const formList10 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入物料编码',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称2',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入名称3',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入颜色',
    inputValue: ''
  },
  {
    type: 'select',
    selectValue: '',
    selectP: '请选择供应商',
    selectOptions: []
  },
  {
    type: 'button',
    checkboxLabel: '组成贴合材料'
  },
  {
    type: 'button',
    checkboxLabel: '插入贴合材料'
  },
  {
    type: 'button',
    checkboxLabel: '物料属性定义'
  },
  {
    type: 'button',
    checkboxLabel: '删除插入贴合材料'
  },
  {
    type: 'button',
    checkboxLabel: '上移'
  },
  {
    type: 'button',
    checkboxLabel: '下移'
  },
  {
    type: 'button',
    checkboxLabel: '插入材料'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '保存',
    bgColor: '#1890FF'
  }
])

const formList11 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '色系',
    selectOptions: []
  },
  {
    type: 'input',
    inputPlaceholder: '颜色',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: 'PANTONE',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '颜色(英)',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '搜索',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '颜色定义'
  }
])

// 贴合子材料明细修改
const listArrayDate = ref()

const mtlNoYes = ref()

const change10 = (row: any, list: any) => {
  ElMessageBox.confirm('请确认要修改当前记录的是否请购标志吗？')
    .then(async () => {
      confirmChange10(list)
    })
    .catch(() => {
      list.purFlag = !list.purFlag
      list = list
    })
}

const confirmChange10 = async (row: any) => {
  row.mtlNo = mtlNoYes.value
  row.purFlag = row.purFlag ? 0 : 1
  listArrayDate.value = row.purFlag
  const result = await LoginWork.post<any, any>(`/usage/getDetailsOfAdhesiveSubMaterialsUpdate/${listArrayDate.value}`, row)
  if (result.code === 200) {
    LaminatedSubmaterialMethods()
    JMessage.success(result.message)
  } else {
    LaminatedSubmaterialMethods()
    JMessage.error(result.message)
  }
}
// 插入材料

const currentRow18 = (row: any) => {
  const { mtlColor, mtlName, mtlNo, vendor, mtlSpec, mtlUnit } = row
  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
}

const InsertTheBondingMaterialMethodsListAParms = ref<InsertTheBondingMaterialParms>({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: -1,
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: ''
})

const InsertTheBondingMaterialMethodsListA = async () => {
  const result = await InsertTheBondingMaterial(InsertTheBondingMaterialMethodsListAParms.value)
  if (result.code === 200) {
    dialogVisible3.value = false

    TypeColorDataQueryMethods()
    JMessage.success(result.message)
  } else {
    TypeColorDataQueryMethods()
    JMessage.error(result.message)
  }
}

// 贴合材料处理
const drawer10 = ref(false)

// 颜色修改
const currentRowToclk15 = (row: any) => {
  const { colorName } = row
  modificationColor.value.mtlColor = colorName
  confirmChange5(modificationColor.value)
  drawer10.value = false
}

// 贴合材料建档列表添加
const MethodOfBondingAddParmsList = ref<ListOfFitAddListInterface>({
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  vendor: ''
})

const MethodOfBondingAdd = async () => {
  const result = await ListOfFitAddList(MethodOfBondingAddParmsList.value)
  if (result.code === 200) {
    JMessage.success(result.message)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc20 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要插入子材料吗?')
    .then(async () => {
      MethodOfBondingAdd()
    })
    .catch(() => {})
}

// 双击添加
const currentRow17 = (row: any) => {
  const { mtlColor, mtlName, mtlNo, mtlSpec, mtlUnit, vendor } = row
  MethodOfBondingAddParmsList.value.mtlColor = mtlColor
  MethodOfBondingAddParmsList.value.mtlName = mtlName
  MethodOfBondingAddParmsList.value.mtlNo = mtlNo
  MethodOfBondingAddParmsList.value.mtlSpec = mtlSpec
  MethodOfBondingAddParmsList.value.mtlUnit = mtlUnit
  MethodOfBondingAddParmsList.value.vendor = vendor
  handleCloseMateriaLKlc20()
}

const Launchform15 = (row: any) => {
  // isLoading3.value = true
  ColorAcquisitionParms.value.colorSystem = row[0].selectValue
  ColorAcquisitionParms.value.colorName = row[1].inputValue
  ColorAcquisitionParms.value.pantone = row[2].inputValue
  ColorAcquisitionParms.value.engColor = row[3].inputValue
  // ColorAcquisition()
}

const modificationColor = ref<any>()

const currentRow15 = (row: any) => {
  drawer10.value = true
  ColorAcquisition()
  colourCchemeMethods()
  modificationColor.value = row
}

const findData15 = (find: string) => {
  if (find === '颜色定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/ColorAttributeDefinition'
    })
  }
  if (find.trim() === '置空') {
    clearFormList2()
  }
  if (find.trim() === '搜索') {
    ColorAcquisition()
  }
}

const choose = ref()

const Vendor = ref<any>()

const TopGoBootom = async () => {
  if (idList.value === undefined) {
    JMessage.warning('请选择需要移动的行')
  } else {
    const result = await Fluctuation(choose.value, idList.value)
    if (result.code === 200) {
      MethodOfBondingMaterial()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  }
}

// 修改贴合材料
const confirmChange5 = async (row?: any) => {
  const colorParam = encodeURIComponent(row.mtlColor)
  const result1 = await LoginWork.get<any, any>(`/ColorAttribute/getYfColorDetail?color=${colorParam}`)
  if (result1.data === null) {
    row.mtlColor = ''
    JMessage.error(`该颜色不存在不可修改`)
    return
  }
  ProductionOfOfficialMaterialsMethodsParms.value.colorCode = result1.data.colorCode
}

// 删除插入贴合材料方法
const change = async (row: any, prop: any) => {
  delete prop.change
  prop.purFlag = prop.purFlag === true ? 'Y' : ''
  prop.vendor = prop.vendor.selectValue.split(' ')[1]
  prop.prdType = prop.prdType.selectValue
  const result = await LoginWork.put<any, any>('/date/getCacheUpdate', prop)
  if (result.code === 200) {
    JMessage.success(result.message)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.message)
  }
}

const TheFitMaterialIsRemovedDeleteParms = ref<any>([])

const handleCloseMateriaLKlc1 = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该插入贴合材料吗?')
    .then(async () => {
      TheFitMaterialIsRemoved()
    })
    .catch(() => {})
}

const TheFitMaterialIsRemoved = async () => {
  const result = await FitMaterialProfileDeleted(TheFitMaterialIsRemovedDeleteParms.value)
  if (result.code === 200) {
    TheFitMaterialIsRemovedDeleteParms.value = []
    JMessage.success(result.message)
    MethodOfBondingMaterial()
  } else {
    JMessage.error(result.message)
  }
}

// 上下移动
const idList = ref()

const currentRow = (row: any) => {
  const { id } = row
  TheFitMaterialIsRemovedDeleteParms.value.push(id)
  idList.value = id
}

const isLoading2 = ref(true)

const isLoading = ref(true)

const isLoading1 = ref(true)

// 贴合材料建档列表

// 获取厂商
const ObtainVendorTableDateList = async () => {
  const result = await ObtainVendor()
  if (result.code === 200) {
    Vendor.value = result.data
    MethodOfBondingMaterial()
  }
}

// 获取贴合加工方式
const FitProcessingMethodTableDateList = ref<FitProcessingMethodInterface[]>()

const FitProcessing = async () => {
  const result = await FitProcessingMethod()
  FitProcessingMethodTableDateList.value = result
}

const NeaArrayList = ref<any>()

const MethodOfBondingMaterialTableDateList = ref<ListOfFitMaterialsInterface[]>()

const MethodOfBondingMaterial = async () => {
  isLoading2.value = true
  const result = await ListOfFitMaterials()
  if (result.length !== 0) {
    MethodOfBondingMaterialTableDateList.value = result.map((item: any) => {
      if (Vendor.value) {
        item.vendor = {
          selectValue: item.vendor || '',
          options: Vendor.value.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1.vendorName,
              value: `${item1.vendorNo} ${item1.vendorName}`,
              LeftLabel: item1.vendorNo,
              RightLabel: item1.vendorName
            }
          })
        }
      }

      if (FitProcessingMethodTableDateList.value) {
        item.prdType = {
          selectValue: item.prdType || '',
          options: FitProcessingMethodTableDateList.value!.map((item1: any, index: any) => {
            if (item1 === null) return
            return {
              label: item1.prdType,
              value: item1.prdType,
              LeftLabel: item1.prdType
            }
          })
        }
      }

      if (item.purFlag === 'Y') {
        item.purFlag = true
      }
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
    if (MethodOfBondingMaterialTableDateList.value.length !== 0) {
      mtlNoListy.value = MethodOfBondingMaterialTableDateList.value[0].mtlNo
      // colorCodety.value = MethodOfBondingMaterialTableDateList.value[0].colorCode
    }
    NeaArrayList.value = MethodOfBondingMaterialTableDateList.value
  } else {
    MethodOfBondingMaterialTableDateList.value = []
  }
  isLoading2.value = false
}

const InputDateList = ref({
  input1: '',
  input2: '',
  input3: '',
  input4: ''
})

const options = ref()

// 单位定义
const UnitDefinitionAddList = async () => {
  const result = await UnitDefinition()
  options.value = result
}

const clearFormList11 = () => {
  formList10.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

const clearFormList15 = () => {
  formList1.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
  })
  formList.value[0].inputValue = ''
}

const router = useRouter()

// 组成贴合材料
const MaterialsMathods = async () => {
  const result = await TheCompositeMaterialIsFormed(
    MethodOfBondingMaterialTableDateList.value!.map((item: any) => {
      // 创建一个新的对象，将原对象的属性复制到新对象中
      const newItem = { ...item }

      // 删除新对象的 "change" 属性
      // delete newItem.change;
      delete newItem.mtlSeq

      // 修改其他属性
      newItem.prdType = item.prdType.selectValue
      newItem.vendor = item.vendor.selectValue
      newItem.purFlag = item.purFlag === true ? 'Y' : ''

      return newItem
    })
  )

  if (result.code === 200) {
    JMessage.success(result.message)
    InputDateList.value.input1 = result.data.mtlName
    InputDateList.value.input2 = result.data.mtlColor
    InputDateList.value.input3 = result.data.mtlSpec
    InputDateList.value.input4 = result.data.mtlUnit
  } else {
    JMessage.error(result.message)
  }
}

const InsertTheBondingMaterialMethodsParms = ref<any>({
  ids: [],
  cacheVoRequests: []
})

const mtlNoListy = ref('')
const colorCodety = ref('')

const InsertTheBondingMaterialMethods = async () => {
  InsertTheBondingMaterialMethodsParms.value.ids = MethodOfBondingMaterialTableDateList.value!.map((item: any) => {
    return item.id
  })
  const mergedObject: any = {
    partList: { styleNo: '', styleColor: '', partName: '', segment: -1, seqNo: '', orderId: UsageChangeQueryMethodsParms.value.orderId },
    ids: [],
    mtlColor: InputDateList.value.input2,
    mtlName: InputDateList.value.input1,
    mtlSpec: InputDateList.value.input3,
    mtlUnit: InputDateList.value.input4,
    cacheVoRequests: [],
    colorCode: '',
    mtlNo: ''
  }
  mergedObject.ids = InsertTheBondingMaterialMethodsParms.value.ids as any

  mergedObject.partList.styleNo = ProductionOfOfficialMaterialsMethodsParms.value.styleNo
  mergedObject.partList.styleColor = ProductionOfOfficialMaterialsMethodsParms.value.styleColor
  mergedObject.partList.partName = ProductionOfOfficialMaterialsMethodsParms.value.partName
  mergedObject.partList.segment = ProductionOfOfficialMaterialsMethodsParms.value.segment as number
  mergedObject.partList.seqNo = ProductionOfOfficialMaterialsMethodsParms.value.seqNo

  mergedObject.mtlNo = mtlNoListy.value

  mergedObject.cacheVoRequests = NeaArrayList.value.map((item: any) => {
    item.prdType = item.prdType.selectValue
    item.vendor = item.vendor.selectValue

    if (item.purFlag) {
      item.purFlag = 'Y'
    }
    return item
  }) as any
  mergedObject.colorCode = mergedObject.cacheVoRequests[0].colorCode
  mergedObject.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await InsertTheBondingMaterialList1(mergedObject as any)
  if (result.code === 200) {
    MethodOfBondingMaterial()
    TypeColorDataQueryMethods()
    FormalMaterialsAndMethodsForDevelopingMaterials()
    dialogVisible3.value = false
    ;(InputDateList.value.input1 = ''), (InputDateList.value.input2 = ''), (InputDateList.value.input3 = ''), (InputDateList.value.input4 = '')
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const findData = (find: string) => {
  if (find === '保存') {
    LaminatedMaterialFileMethods()
  }
  if (find === '置空') {
    clearFormList11()
  }
  if (find === '物料属性定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
    })
  }
  if (find === '删除插入贴合材料') {
    if (TheFitMaterialIsRemovedDeleteParms.value.length !== 0) {
      handleCloseMateriaLKlc1()
    } else {
      JMessage.warning('请选择需要删除的数据')
    }
  }
  if (find === '上移') {
    choose.value = 0
    TopGoBootom()
  }
  if (find === '下移') {
    choose.value = 1
    TopGoBootom()
  }
  if (find === '组成贴合材料') {
    if (MethodOfBondingMaterialTableDateList.value?.length !== 0) {
      MaterialsMathods()
      UnitDefinitionAddList()
    } else {
      JMessage.warning('请选择正确的贴合材料建档')
    }
  }

  if (find === '插入贴合材料') {
    if (InputDateList.value.input1 !== '' || InputDateList.value.input2 !== '' || InputDateList.value.input3 !== '') {
      InsertTheBondingMaterialMethods()
    } else {
      JMessage.warning('请选择正确的贴合材料建档')
    }
  }

  if (find === '插入材料') {
    InsertTheBondingMaterialMethodsListA()
  }
}

const Launchform11 = (row: any) => {
  isLoading.value = true
  isLoading1.value = true
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlNo = row[0].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName = row[1].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName2 = row[2].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName3 = row[3].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlColor = row[4].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.vendor = row[5].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const VendorDataShow = async () => {
  const result = await VendorData()
  let NewArray1 = []
  NewArray1 = result.vendor.reduce((arr: any, item: any) => {
    if (item.vendorNo && item.vendorName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.vendorNo + ' ' + item.vendorName)
    }
    return arr
  }, [])

  formList10.value[3].selectOptions = EvaluatesTheArrayReturnValue(NewArray1)
}

// 型体颜色下拉框
const vableState = ref(0)

const selectListShow = (row?: any, visible?: boolean) => {
  if (vableState.value === 1) {
    if (visible === true) {
      if (row !== undefined) {
        // row.partName = {
        //   selectValue: row.partName.selectValue,
        //   options: listanyTableDateSelect,
        //   PageModule: true,
        //   total: totalListpartName,
        //   handleSizeChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        // }
        // row.vendor = {
        //   selectValue: row.vendor.selectValue,
        //   options: VendorListValue,
        //   PageModule: true,
        //   total: totalListArray,
        //   handleSizeChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        // }
        row.usageType = {
          selectValue: row.usageType.selectValue,
          options: [
            { value: '全码', label: '全码' },
            { value: '基本码', label: '基本码' },
            { value: '中间码', label: '中间码' }
          ]
        }
        row.drawDept = {
          selectValue: row.drawDept.selectValue,
          options: [
            { value: '冲裁', label: '冲裁' },
            { value: '外协', label: '外协' },
            { value: '电脑车', label: '电脑车' },
            { value: '针车', label: '针车' },
            { value: '成型', label: '成型' }
          ]
        }
        row.sizeType = {
          selectValue: row.sizeType.selectValue,
          options: [
            { value: '全号', label: '全号' },
            { value: '整号', label: '整号' },
            { value: '半号', label: '半号' }
          ]
        }
        row.mtlProperty = {
          selectValue: row.mtlProperty.selectValue,
          options: [
            { value: '冲裁主料', label: '冲裁主料' },
            { value: '冲裁辅料', label: '冲裁辅料' },
            { value: '针车辅料', label: '针车辅料' }
          ]
        }
      } else {
        if (row.partName === Object) {
          row.partName.options = []
          // row.vendor.options = []
          row.usageType.options = []
          row.drawDept.options = []
          row.sizeType.options = []
          row.mtlProperty.options = []
        }
      }
    }
  } else {
    if (visible === true) {
      if (row !== undefined) {
        // PositionDetailQueryMethodsParms.value.partName = row.partName.selectValue
        // PositionDetailQueryMehtods()
        // row.partName = {
        //   selectValue: row.partName.selectValue,
        //   options: listanyTableDateSelect,
        //   PageModule: true,
        //   total: totalListpartName,
        //   handleSizeChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     PositionDetailQueryMethodsParms.value.pageNum = val
        //     PositionDetailQueryMehtods()
        //   },
        // }
        // row.vendor = {
        //   selectValue: row.vendor.selectValue,
        //   options: VendorListValue,
        //   PageModule: true,
        //   total: totalListArray,
        //   handleSizeChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        //   handleCurrentChange: (val: any) => {
        //     GetVendorListListParmsMethods.value.pageNum = val
        //     GetVendorListMethods()
        //   },
        // }
        row.usageType = {
          selectValue: row.usageType.selectValue,
          options: [
            { value: '全码', label: '全码' },
            { value: '基本码', label: '基本码' },
            { value: '中间码', label: '中间码' }
          ]
        }
        row.drawDept = {
          selectValue: row.drawDept.selectValue,
          options: [
            { value: '冲裁', label: '冲裁' },
            { value: '外协', label: '外协' },
            { value: '电脑车', label: '电脑车' },
            { value: '针车', label: '针车' },
            { value: '成型', label: '成型' }
          ]
        }
        row.sizeType = {
          selectValue: row.sizeType.selectValue,
          options: [
            { value: '全号', label: '全号' },
            { value: '整号', label: '整号' },
            { value: '半号', label: '半号' }
          ]
        }
        row.mtlProperty = {
          selectValue: row.mtlProperty.selectValue,
          options: [
            { value: '冲裁主料', label: '冲裁主料' },
            { value: '冲裁辅料', label: '冲裁辅料' },
            { value: '针车辅料', label: '针车辅料' }
          ]
        }
      }
    } else {
      if (row !== undefined && row.partName === Object) {
        row.partName.options = []
        // row.vendor.options = []
        row.usageType.options = []
        row.drawDept.options = []
        row.sizeType.options = []
        row.mtlProperty.options = []
      }
    }
  }
}

// 用量明细置空
const findClicked10 = (row: any) => {
  if (row === '置空') {
    clearFormList10()
  }
}

const clearFormList10 = () => {
  formList3.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

// 厂商获取
const EvaluatesTheArrayReturnValue1 = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      value: item,
      label: item
    }
  })
}

const GetVendorListListParmsMethods = ref<GetVendorListListParms>({
  pageNum: 1,
  pageSize: 40
})

const VendorListValue = ref([])

const GetVendorListMethods = async () => {
  let NewArray = []
  const result = await GetVendorList(GetVendorListListParmsMethods.value)
  NewArray = result.dtos.reduce((arr: any, item: any) => {
    if (item.vendorNo && item.vendorName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.vendorNo + ' ' + item.vendorName)
    }
    return arr
  }, [])
  // AddDetailData.value.vendor.options = EvaluatesTheArrayReturnValue1(NewArray)
  VendorListValue.value = EvaluatesTheArrayReturnValue1(NewArray)
  totalListArray.value = result.total
  selectListShow()
}

const totalListArray = ref(0)

const totalListpartName = ref(0)

const AddDetailData = ref({
  seqNo: '',
  // partName: {
  //   selectValue: '',
  //   options: [],
  //   PageModule: true,
  //   total: totalListpartName,
  //   handleSizeChange: (val: any) => {
  //     PositionDetailQueryMethodsParms.value.pageNum = val
  //     PositionDetailQueryMehtods()
  //   },
  //   handleCurrentChange: (val: any) => {
  //     PositionDetailQueryMethodsParms.value.pageNum = val
  //     PositionDetailQueryMehtods()
  //   },
  // },
  segment: '',
  mtlNo: '',
  mtlColor: '',
  mtlName: '',
  mtlSoec: '',
  mtlUnit: '',
  size1: '',
  size2: '',
  // vendor: {
  //   selectValue: '',
  //   options: [],
  //   PageModule: true,
  //   total: totalListArray,
  //   handleSizeChange: (val: any) => {
  //     GetVendorListListParmsMethods.value.pageNum = val
  //     GetVendorListMethods()
  //   },
  //   handleCurrentChange: (val: any) => {
  //     GetVendorListListParmsMethods.value.pageNum = val
  //     GetVendorListMethods()
  //   },
  // },
  usage: '',
  usageType: '',
  drawDept: '',
  sizeType: '',
  mtlProperty: '',
  noLotUsage: '',
  remark: '',
  disableConfirm: true,
  change: 'Y'
})

// 部位明细
const PositionDetailQueryMethodsParms = ref<PositionDetailQueryPamrs>({
  engPartName: '',
  pageNum: 1,
  pageSize: 40,
  partName: '',
  seqNo: ''
})

const listanyTableDateSelect = ref([])

const PositionDetailQueryMehtods = async (row?: any) => {
  let NewArray = []
  const result = await PositionDetailQuery(PositionDetailQueryMethodsParms.value)
  if (result.total === 0) {
    JMessage.error('暂无该部位')
    row.partName = ''
    return
  }
  // NewArray = result.partList.reduce((arr: any, item: any) => {
  //   if (item.partName) { // 只添加非空的 typeName 和 typeNo
  //     arr.push(item.partName);
  //   }
  //   return arr;
  // }, []);
  // AddDetailData.value.partName.options = EvaluatesTheArrayReturnValue1(NewArray)
  // listanyTableDateSelect.value = EvaluatesTheArrayReturnValue1(NewArray)
  totalListpartName.value = result.total
}

// 复制用量
const ReplicationDosageMethodsParms = ref<any>([])

const selectedList12 = (row: any) => {
  ReplicationDosageMethodsParms.value = row.map((item: any) => {
    return item
  })
}

const ReplicationDosageMethods = async () => {
  const result = await LoginWork.post<any, any>(`/usage/getCopyingDosage`, {
    currentStyleColor: UsageChangeQueryMethodsParms.value.styleColor,
    currentStyleNo: UsageChangeQueryMethodsParms.value.styleNo,
    list: ReplicationDosageMethodsParms.value
  })
  if (result.code === 200) {
    dialogVisible5.value = false
    JMessage.success(result.message)
  } else {
    dialogVisible5.value = false
    JMessage.error(result.message)
  }
}

// 复制用量查询列表
const dialogVisible5 = ref(false)

const ReplicationVolumeQueryTableDateList = ref<any>({
  list: []
})

const totalActiveList = ref(0)

const Launchform10 = (row: any) => {
  ReplicationVolumeQueryTableDateListParms.value.styleNo = row[0].inputValue
  ReplicationVolumeQuery()
}

const ReplicationVolumeQueryTableDateListParms = ref<any>({
  pageNum: 1,
  pageSize: 20,
  styleNo: ''
})

const ReplicationVolumeQuery = async () => {
  const result = await LoginWork.post<any, any>(
    `/usage/getCopyingDosageList`,
    Object.assign(
      {},
      { currentStyleColor: UsageChangeQueryMethodsParms.value.styleColor, currentStyleNo: UsageChangeQueryMethodsParms.value.styleNo },
      ReplicationVolumeQueryTableDateListParms.value
    )
  )
  ReplicationVolumeQueryTableDateList.value.list = result.data.list
  totalActiveList.value = result.data.total
}

const handleSizeChangeTkList = (val: number) => {
  ReplicationVolumeQueryTableDateListParms.value.pageNum = val
  ReplicationVolumeQuery()
}

const handleCurrentChangeTkList = (val: number) => {
  ReplicationVolumeQueryTableDateListParms.value.pageNum = val
  ReplicationVolumeQuery()
}

// 删除全码用量
const listValueDate = ref<any>([])

const currentRow10 = (row: any) => {
  listValueDate.value.push(row)
  listValueDate.value = listValueDate.value.map((item: any) => {
    item.segment = UpdateFullCodeUsageMethodsParmsList.value[0].segment
    item.partName = UpdateFullCodeUsageMethodsParmsList.value[0].partNmae
    return item
  })
}

const DeleteTheFullCodeUsage = async () => {
  if (cfmFlagList.value === 'Y') {
    JMessage.warning('已检核不可删除')
  } else {
    const result = await LoginWork.post<any, any>('/usage/getFullCodeDetailDel', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      list: listValueDate.value
    })
    if (result.code === 200) {
      TypeQueryMethods()
      listValueDate.value = []
      JMessage.success(result.message)
    } else {
      TypeQueryMethods()
      listValueDate.value = []
      JMessage.error(result.message)
    }
  }
}

const handleCloseMateriaLKlcLtvCodeUsage = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      DeleteTheFullCodeUsage()
    })
    .catch(() => {})
}

// 整单型体颜色删除
const WholeBodyColor = async () => {
  if (cfmFlagList.value === 'Y') {
    JMessage.warning('已检核不可删除')
  } else {
    const result = await LoginWork.post<any, any>('/developmentUsage/getDeleteStyleColorList', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      orderId: UsageChangeQueryMethodsParms.value.orderId
    })
    if (result.code === 200) {
      TypeQueryMethods()
      JMessage.success(result.message)
    } else {
      TypeQueryMethods()
      JMessage.error(result.message)
    }
  }
}

const handleCloseMateriaLKlcLtv = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      WholeBodyColor()
    })
    .catch(() => {})
}

// 重排序号
const cfmFlagList = ref()

const ReorderList = async () => {
  if (cfmFlagList.value === 'Y') {
    JMessage.warning('已检核不可重排序号')
  } else {
    const result = await LoginWork.post<any, any>('/developmentUsage/getReordering', {
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      cfmFlag: cfmFlagList.value,
      orderId: UsageChangeQueryMethodsParms.value.orderId
    })
    if (result.code === 200) {
      TypeColorDataQueryMethods()
      JMessage.success(result.message)
    } else {
      TypeColorDataQueryMethods()
      JMessage.error(result.message)
    }
  }
}

// 贴合材料处理
const dialogVisible3 = ref(false)

// 生产正是材料并选择到用量表
const ProductionOfOfficialMaterialsMethodsParms = ref<any>({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: null,
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: ''
})

const ProductionOfOfficialMaterialsMethods = async () => {
  if (ProductionOfOfficialMaterialsMethodsParms.value.mtlName === '') {
    JMessage.warning('材料名称不可为空')
    return
  }

  if (ProductionOfOfficialMaterialsMethodsParms.value.mtlColor === '') {
    handleCloseMateriaLKlc3()
    return
  }

  resultMethods()
}

const resultMethods = async () => {
  ProductionOfOfficialMaterialsMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
  const result = await ProductionOfOfficialMaterials(ProductionOfOfficialMaterialsMethodsParms.value)
  if (result.code === 200) {
    TypeColorDataQueryMethods()
    dialogVisible2.value = false
    vableState.value = 0
    JMessage.success(result.message)
  } else {
    vableState.value = 0
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc3 = (_done?: () => void) => {
  ElMessageBox.confirm('请确认材料颜色为空?')
    .then(async () => {
      resultMethods()
    })
    .catch(() => {})
}

const currentRow8 = (row: any) => {
  const { mtlName, mtlSpec, mtlUnit, vendor, mtlNo } = row
  ProductionOfOfficialMaterialsMethodsParms.value.mtlName = mtlName
  ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = mtlSpec
  ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = mtlUnit
  ProductionOfOfficialMaterialsMethodsParms.value.vendor = vendor
  ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = mtlNo
}

// 颜色获取
const clearFormList2 = () => {
  formList7.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
    if (item.type === 'select') {
      item.selectValue = ''
    }
  })
}

const dbClickListColor = () => {
  isListTav.value = false
  ColorAcquisition()
  colourCchemeMethods()
  drawer.value = true
}

const colourCchemeMethods = async () => {
  const result = await colourCcheme()
  formList7.value[0].selectOptions = EvaluatesTheArrayReturnValue(result)
}

const isLoading3 = ref(true)

const drawer = ref(false)

watch(drawer, (newVal, oldVal) => {
  if (drawer.value === false) {
    isListTav.value = true // 当 drawer 的值变化时，将 isListTav 设置为 true
  }
})

const Launchform8 = (row: any) => {
  // isLoading3.value = true
  ColorAcquisitionParms.value.colorSystem = row[0].selectValue
  ColorAcquisitionParms.value.colorName = row[1].inputValue
  ColorAcquisitionParms.value.pantone = row[2].inputValue
  ColorAcquisitionParms.value.engColor = row[3].inputValue
  // ColorAcquisition()
}

const findData1 = (find: string) => {
  if (find === '颜色定义') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/ColorAttributeDefinition'
    })
  }
  if (find === '置空') {
    clearFormList2()
  }
  if (find === '搜索') {
    ColorAcquisition()
  }
}

const ColorAcquisitionParms = ref<chooseAColorParms>({
  colorName: '',
  colorSystem: '',
  engColor: '',
  pageNum: 1,
  pageSize: 40,
  pantone: ''
})

const ColorAcquisitionTableDateList = ref<chooseAColorInterface>({
  colorSystemList: []
})

const ColorAcquisition = async () => {
  const result = await chooseAColor(ColorAcquisitionParms.value)
  ColorAcquisitionTableDateList.value.colorSystemList = result.colorSystemList
  totalKlt.value = result.total!
  isLoading3.value = false
}

const totalKlt = ref(0)

const handleSizeChange2 = (val: number) => {
  isLoading3.value = true
  ColorAcquisitionParms.value.pageNum = val
  ColorAcquisition()
}

const handleCurrentChange2 = (val: number) => {
  isLoading3.value = true
  ColorAcquisitionParms.value.pageSize = val
  ColorAcquisition()
}

const currentRowToclk = (row: any) => {
  const { colorName, colorCode } = row
  ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = colorName
  ProductionOfOfficialMaterialsMethodsParms.value.colorCode = colorCode
  drawer.value = false
}

// 选择当前行正式材料到用量表
const CopyDataMethodsPamrsList = ref({
  mtlNmae: '',
  mtlColor: '',
  mtlSpace: '',
  mtUnit: '',
  vendor: ''
})

const UsageChangeQueryMethodsParms = ref<any>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: '',
  orderId: ''
})

const currentRow7 = (row: any) => {
  const { mtlColor, mtlName, mtlNo, mtlSpec, mtlUnit, vendor } = row
  SelectTheCurrentRowToInsertMethodsParms.value.mtlColor = mtlColor
  SelectTheCurrentRowToInsertMethodsParms.value.mtlName = mtlName
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo
  SelectTheCurrentRowToInsertMethodsParms.value.mtlSpec = mtlSpec
  SelectTheCurrentRowToInsertMethodsParms.value.mtlUnit = mtlUnit
  SelectTheCurrentRowToInsertMethodsParms.value.vendor = vendor
  deleteCofficialMethodsParms.value = mtlNo
}

const SelectTheCurrentRowToInsertMethodsParms = ref<any>({
  colorCode: '',
  mtlColor: '',
  mtlName: '',
  mtlNo: '',
  mtlSpec: '',
  mtlUnit: '',
  partName: '',
  segment: null,
  seqNo: '',
  styleColor: '',
  styleNo: '',
  vendor: ''
})

const SelectTheCurrentRowToInsertMethods = async () => {
  if (SelectTheCurrentRowToInsertMethodsParms.value.mtlNo === '') {
    JMessage.warning('请选择需要插入的数据')
  } else {
    SelectTheCurrentRowToInsertMethodsParms.value.orderId = UsageChangeQueryMethodsParms.value.orderId
    const result = await SelectTheCurrentRowToInsert(SelectTheCurrentRowToInsertMethodsParms.value)
    if (result.code === 200) {
      TypeColorDataQueryMethods()
      vableState.value = 0
      dialogVisible2.value = false
      JMessage.success(result.message)
    } else {
      vableState.value = 0
      JMessage.error(result.message)
    }
  }
}

const clearFormList1 = () => {
  formList6.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    }
  })
}

const findClicked6 = (count: string) => {
  if (count === '置空') clearFormList1()
  if (count === '转面材材料建档') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/SurfaceMaterialDataFile'
    })
  }
  if (count === '转成型材料建档') {
    router.push({
      path: '/ControlDepartment/MaterialManagement/FormingMaterialFile'
    })
  }
  if (count === '删除正式材料') {
    if (deleteCofficialMethodsParms.value === '') {
      JMessage.warning('请选择需要删除的数据')
    } else {
      handleCloseMateriaLKlc12()
    }
  }
}

// 选择材料
const dialogVisible2 = ref(false)

const Launchform7 = (row: any) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlNo = row[0].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName = row[1].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName2 = row[2].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlName3 = row[3].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.mtlColor = row[4].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.vendor = row[5].inputValue
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

// 正式材料和开发材料
const FormalMaterialsAndMethodsForDevelopingTableDateList = ref<FormalMaterialsAndDevelopmentMaterialsParms>({
  officialMaterials: {
    adhesiveMaterialList: []
  },
  developmentMaterials: {
    developmentMaterialsList: []
  }
})

const FormalMaterialsAndMethodsForDevelopingMaterialsParms = ref<any>({
  mtlColor: '',
  mtlName: '',
  mtlName2: '',
  mtlName3: '',
  mtlNo: '',
  pageNum: 1,
  pageNum2: 1,
  pageSize: 40,
  pageSize2: 40,
  vendor: ''
})

const FormalMaterialsAndMethodsForDevelopingMaterials = async () => {
  const result = await FormalMaterialsAndDevelopmentMaterials(FormalMaterialsAndMethodsForDevelopingMaterialsParms.value)
  totalofficial.value = result.developmentMaterials.total!
  totalExploit.value = result.officialMaterials.total!
  FormalMaterialsAndMethodsForDevelopingTableDateList.value.developmentMaterials.developmentMaterialsList =
    result.developmentMaterials.developmentMaterialsList
  FormalMaterialsAndMethodsForDevelopingTableDateList.value.officialMaterials.adhesiveMaterialList = result.officialMaterials.adhesiveMaterialList
}

const totalExploit = ref(0)

const handleSizeChangeExploit = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageSize = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const handleCurrentChangeExploit = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageNum = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const totalofficial = ref(0)

const handleSizeChangeofficial = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageSize2 = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

const handleCurrentChangeofficial = (val: number) => {
  FormalMaterialsAndMethodsForDevelopingMaterialsParms.value.pageNum2 = val
  FormalMaterialsAndMethodsForDevelopingMaterials()
}

// 更新全码用量
const UpdateFullCodeUsageMethodsParms = ref<UpdateFullCodeUsagePamrs>({
  list: [],
  styleColor: '',
  styleNo: ''
})

const UpdateFullCodeUsageMethodsParmsList = ref<any>([])

const partNameList = ref<any>({
  segment: '',
  partNmae: ''
})

const UpdateFullCodeUsageMethods = async () => {
  if (partNameList.value.segment === '') {
    JMessage.warning('还未选择型体颜色材料输入的数据')
  } else {
    UpdateFullCodeUsageMethodsParms.value.list = UpdateFullCodeUsageMethodsParms.value.list.concat(
      FullCodeUsageDataMethodsTableDateLsit.value.map((item: any) => {
        item.segment = partNameList.value.segment
        item.partName = partNameList.value.partNmae
        item.mtlUsage = Number(item.mtlUsage)
        item.sizeFrom = Number(item.sizeFrom)
        delete item.change
        delete item.disableConfirm

        return item
      })
    )

    const result = await UpdateFullCodeUsage({
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      list: UpdateFullCodeUsageMethodsParms.value.list.concat(AllListMethodsTableDateList.value)
    })
    if (result.code === 200) {
      FullCodeUsageDataMethods()
      UpdateFullCodeUsageMethodsParms.value.list = []
      JMessage.success(result.message)
    } else {
      UpdateFullCodeUsageMethodsParms.value.list = []
      JMessage.error(result.message)
    }
  }
}

// 复制资料
const dialogVisible1 = ref(false)

const CopyDataMethodsPamrs = ref<any>({
  colorCode: '',
  newColorCode: '',
  newStyleColor: '',
  newStyleNo: '',
  styleColor: '',
  styleNo: '',
  wantColor: '0',
  newOrderId: '',
  orderId: ''
})

const CopyDataMethods = async () => {
  const result = await CopyData(CopyDataMethodsPamrs.value)
  if (result.code === 200) {
    CopyDataMethodsPamrs.value.newColorCode = ''
    CopyDataMethodsPamrs.value.newStyleColor = ''
    CopyDataMethodsPamrs.value.newOrderId = ''
    dialogVisible1.value = false
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const findClicked5 = (row: string) => {
  if (row === '保存') {
    if (CopyDataMethodsPamrs.value.newStyleNo === '' || CopyDataMethodsPamrs.value.newOrderId === '') {
      JMessage.warning('型体和订单号不可为空不')
    } else {
      CopyDataMethods()
    }
  }
}

// 注意事项建档保存
const inputChange = async (row: any) => {
  delete row.change
  const result = await LoginWork.post<any, any>('/developmentUsage/getPrecautionsForFilingSave', {
    styleColor: UsageChangeQueryMethodsParms.value.styleColor,
    styleNo: UsageChangeQueryMethodsParms.value.styleNo,
    list: PrecautionsFileMethodsParmsDateList.value,
    orderId: TypeColorDataQueryMethodsPamrs.value.orderId
  })
  if (result.code === 200) {
    PrecautionsFileMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 注意事项建档
const PrecautionsFileMethodsParmsDateList = ref([])

const PrecautionsFileMethods = async () => {
  const reuslt = await PrecautionsFileList({
    styleColor: UsageChangeQueryMethodsParms.value.styleColor,
    styleNo: UsageChangeQueryMethodsParms.value.styleNo,
    orderId: TypeColorDataQueryMethodsPamrs.value.orderId
  })
  setTimeout(async () => {
    const result = await PrecautionsFile({
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      orderId: TypeColorDataQueryMethodsPamrs.value.orderId
    })
    PrecautionsFileMethodsParmsDateList.value = result.map((item: any) => {
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
  }, 1)
}

// 用量变更查询
const drawer5 = ref(false)

const UsageChangeQueryMethodsTableDateList = ref<UsageChangeQueryInterface>({
  list: []
})

const UsageChangeQueryMethods = async () => {
  const result = await UsageChangeQuery(UsageChangeQueryMethodsParms.value)
  UsageChangeQueryMethodsTableDateList.value.list = result.list
}

const totalA = ref(0)

const handleSizeChangeA = (val: number) => {
  UsageChangeQueryMethodsParms.value.pageSize = val
  UsageChangeQueryMethods()
}

const handleCurrentChangeA = (val: number) => {
  UsageChangeQueryMethodsParms.value.pageNum = val
  UsageChangeQueryMethods()
}

const EvaluatesTheArrayReturnValue = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      optionKey: index,
      optionValue: item,
      optionLabel: item
    }
  })
}

// 库存材料
const classifyQueryMethods = async () => {
  let NewArray = []
  const result = await classifyQuery()
  NewArray = result.reduce((arr: any, item: any) => {
    if (item.typeNo && item.typeName) {
      // 只添加非空的 typeName 和 typeNo
      arr.push(item.typeNo + ' ' + item.typeName)
    }
    return arr
  }, [])
  formList3.value[5].selectOptions = EvaluatesTheArrayReturnValue(NewArray)
}

// 全码用量
const currentRow5 = (row: any) => {
  const { styleNo, styleColor, partName, segment } = row
  AllListMethodsParms.value.styleColor = styleColor
  AllListMethodsParms.value.styleNo = styleNo
  AllListMethodsParms.value.partName = partName
  AllListMethodsParms.value.segment = segment
  AllListMethods()
}

const AllListMethodsParms = ref<FullCodeUsageDataParms>({
  styleNo: '',
  styleColor: '',
  partName: '',
  segment: -1
})

const AllListMethodsTableDateList = ref([])

const AllListMethods = async () => {
  const result = await FullCodeUsageData(AllListMethodsParms.value)
  AllListMethodsTableDateList.value = result
}

// 用量明细查询
const drawer3 = ref(false)

const UsageDetailQueryMethodsTableDateList = ref<UsageDetailQueryParmsList>({
  list: []
})

const UsageDetailQueryMethodsParms = ref<UsageDetailQueryPamrsList>({
  mtlColor: '',
  mtlName: '',
  pageNum: 1,
  pageSize: 40,
  partName: '',
  styleColor: '',
  styleNo: '',
  typeName: ''
})

const Launchform5 = (row: any) => {
  UsageDetailQueryMethodsParms.value.styleNo = row[0].inputValue
  UsageDetailQueryMethodsParms.value.styleColor = row[1].inputValue
  UsageDetailQueryMethodsParms.value.mtlName = row[2].inputValue
  UsageDetailQueryMethodsParms.value.mtlColor = row[3].inputValue
  UsageDetailQueryMethodsParms.value.partName = row[4].inputValue

  UsageDetailQueryMethodsParms.value.typeName = row[5].selectValue.split(' ')[1]
  UsageDetailQueryMethods()
}

const loading3 = ref(false)

const UsageDetailQueryMethods = async () => {
  loading3.value = true
  const result = await UsageDetailQuery(UsageDetailQueryMethodsParms.value)
  UsageDetailQueryMethodsTableDateList.value.list = result.list.map((item: any) => {
    if (item.noLotUsage === 'Y') {
      item.noLotUsage = true
    }
    return item
  })
  if (result.list.length > 0) {
    AllListMethodsParms.value.styleColor = result.list[0].styleColor
    AllListMethodsParms.value.styleNo = result.list[0].styleNo
    AllListMethodsParms.value.partName = result.list[0].partName
    AllListMethodsParms.value.segment = result.list[0].segment
    AllListMethods()
  }
  totalList.value = result.total!
  loading3.value = false
}

const totalList = ref(0)

const handleSizeChangeList = (val: number) => {
  UsageDetailQueryMethodsParms.value.pageSize = val
  UsageDetailQueryMethods()
}

const handleCurrentChangeList = (val: number) => {
  UsageDetailQueryMethodsParms.value.pageNum = val
  UsageDetailQueryMethods()
}

// 增加明细资料
const dialogVisible = ref(false)

const findClicked1 = async (row: any) => {
  if (row === '保存修改基本号码') {
    if (ubdateSizeNoMethodsParms.value.baseSize === '') {
      JMessage.warning('型体基本号码不可为空')
    } else {
      ubdateSizeNoMethods()
    }
  }
  if (row === '增加明细资料') {
    if (purFlagList.value) {
      if (tableDateList.value) {
        let newDetailData = { ...AddDetailData.value, isLocal: true }
        let index = TypeColorDataQueryMethodsInterfaceTableDateList.value.findIndex((item) => item.seqNo === tableDateList.value.seqNo)

        if (index !== -1) {
          // 设置新元素的 seqNo
          newDetailData.seqNo = (Number(tableDateList.value.seqNo) + 1) as any

          // 在找到的索引后插入新数据
          TypeColorDataQueryMethodsInterfaceTableDateList.value.splice(index + 1, 0, newDetailData as any)

          // 更新插入位置之后的所有元素的 seqNo
          for (let i = index + 2; i < TypeColorDataQueryMethodsInterfaceTableDateList.value.length; i++) {
            TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo =
              Number(TypeColorDataQueryMethodsInterfaceTableDateList.value[i].seqNo) + 1
          }

          // 调用获取供应商列表方法
          GetVendorListMethods()

          // 调用查询明细资料方法
          PositionDetailQueryMehtods()
        }
      } else {
        // 复制新数据对象
        let newDetailData = { ...AddDetailData.value }

        // 获取列表中已有的最大序号
        let maxSeqNo = Math.max(...TypeColorDataQueryMethodsInterfaceTableDateList.value.map((item: any) => item.seqNo), 0)

        // 设置新数据对象的序号为最大序号加1
        newDetailData.seqNo = (maxSeqNo + 1) as any

        // 将新条目添加到列表中
        TypeColorDataQueryMethodsInterfaceTableDateList.value.push(newDetailData as any)

        // 更新列表数据
        TypeColorDataQueryMethodsInterfaceTableDateList.value = [...TypeColorDataQueryMethodsInterfaceTableDateList.value]

        // 重置查询参数
        PositionDetailQueryMethodsParms.value.engPartName = ''
        // PositionDetailQueryMethodsParms.value.partName = '';
        PositionDetailQueryMethodsParms.value.seqNo = ''

        // 调用获取供应商列表方法
        GetVendorListMethods()

        // 调用查询明细资料方法
        PositionDetailQueryMehtods()
      }
    } else {
      JMessage.warning('已检核的数据不可新增')
    }
  }
  if (row === '用量明细查询') {
    drawer3.value = true
    classifyQueryMethods()
    UsageDetailQueryMethods()
  }
  if (row === '用量变更查询') {
    drawer5.value = true
    UsageChangeQueryMethods()
  }
  if (row === '注意事项建档') {
    PrecautionsFileMethods()
    dialogVisible.value = true
  }
  if (row === '复制资料') {
    dialogVisible1.value = true
  }
  if (row === '删除打勾记录') {
    if (DeleteTheCurrentRowDataPmars.value.seqNoList.length === 0) {
      JMessage.warning('请选择需要删除的记录')
    } else {
      handleCloseMateriaLKlc()
    }
  }

  if (row === '选择材料') {
    if (purFlagList.value) {
      if (SelectTheCurrentRowToInsertMethodsParms.value.seqNo === '') {
        JMessage.warning('请选择需要修改的数据')
      } else {
        FormalMaterialsAndMethodsForDevelopingMaterials()
        dialogVisible2.value = true
      }
    } else {
      JMessage.warning('已检核的数据不可修改')
    }
  }
  if (row === '贴合材料处理') {
    if (purFlagList.value) {
      if (SelectTheCurrentRowToInsertMethodsParms.value.partName === '') {
        JMessage.warning('请选择需要修改的数据')
      } else {
        BondingMaterialTreatmentMethods()

        FitProcessing()
        ObtainVendorTableDateList()
        VendorDataShow()
        FormalMaterialsAndMethodsForDevelopingMaterials()
        UnitDefinitionAddList()
        dialogVisible3.value = true
      }
    } else {
      JMessage.warning('已检核的数据不可修改')
    }
  }
  if (row === '重排序号') {
    ReorderList()
  }
  if (row === '整单型体颜色删除') {
    handleCloseMateriaLKlcLtv()
  }

  if (row === '复制用量') {
    ReplicationVolumeQuery()
    dialogVisible5.value = true
  }

  if (row === 'BOM表导出') {
    // TypeQueryMethodsPamrs1.value.styleNo = TypeQueryMethodsPamrs1.value.style
    const res = (await fileRequest.post(`/developmentUsage/exportBom`, styleNoParms.value)) as any
    const link = document.createElement('a') // 利用a标签自定义下载文件名
    let blob = new Blob([res.data]) // 创建Blob对象，设置文件类型
    link.style.display = 'none'
    //设置连接
    link.href = window.URL.createObjectURL(blob)
    link.download = `研发用量建档导出${Date.now()}.xls` //自定义文件名字
    document.body.appendChild(link)
    //模拟点击事件
    link.click()
    document.body.removeChild(link)
  }

  if (row === '全码用量资料明细') {
    FullCodeUsageDataMethods()
    AllSizeNo.value = true
  }
}

const numberList = ref<any>([])

const styleNoParms = ref({
  styleNo: '',
  styleColor: '',
  cfmFlag: '',
  orderId: ''
})

const loading1 = ref(false)

// 型体备注
const styleColorRemark = ref('')

const saveDateListMethods = async () => {
  const partNameSegments = new Map() // 用于存储每个 partName 的 segment 值
  saveDateListMethodsParms.value.styleColorMaterialRequests = saveDateListMethodsParms.value.styleColorMaterialRequests.filter(
    (item: any) => item.partName
  )

  saveDateListMethodsParms.value.styleColorMaterialRequests.forEach((item: any) => {
    item.partName = item.partName
    // item.drawDept = item.drawDept.selectValue ? item.drawDept.selectValue : '';
    // item.mtlProperty = item.mtlProperty.selectValue ? item.mtlProperty.selectValue : '';
    // item.sizeType = item.sizeType.selectValue ? item.sizeType.selectValue : '';
    // item.usageType = item.usageType.selectValue ? item.usageType.selectValue : '';
    item.vendor = item.vendor
    delete item.isLocal

    // 检查 partName 是否已经存在
    if (partNameSegments.has(item.partName)) {
      // 如果 partName 已存在，segment 在原有基础上增加 1
      item.segment = partNameSegments.get(item.partName) + 1
    } else {
      // 如果 partName 不存在，segment 设置为 0
      item.segment = 0
    }

    // 更新 partName 的 segment 值
    partNameSegments.set(item.partName, item.segment)

    // 检查 usage 是否有效
    if (item.usage === '' || isNaN(item.usage) || item.usage === 0) {
      item.usage = null
    } else {
    }
  })
  saveDateListMethodsParms.value.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
  const result = await saveDateList(saveDateListMethodsParms.value)
  if (result.code === 200) {
    TypeColorDataQueryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 保存
const saveDateListMethodsParms = ref<any>({
  styleColor: '',
  styleColorMaterialRequests: [],
  styleColorRemark: styleColorRemark.value,
  styleNo: ''
})

// 审核取消检核
const FullNnumer = ref()

const FullCodeUsageDataMethodsParms = ref<FullCodeUsageDataParms>({
  partName: '',
  segment: -1,
  styleColor: '',
  styleNo: ''
})

const FullCodeUsageCheckMethodsParms = ref<any>({
  styleColor: '',
  styleNo: ''
})

const FullCodeUsageCheckMethods = async () => {
  FullCodeUsageCheckMethodsParms.value.orderId = TypeColorDataQueryMethodsPamrs.value.orderId
  const result = await FullCodeUsageCheck(FullNnumer.value, FullCodeUsageCheckMethodsParms.value)
  if (result.code === 200) {
    ColorCodePictureMethods()
    JMessage.success(result.message)
  } else {
    ColorCodePictureMethods()
    JMessage.error(result.message)
  }
}

// 全码用量资料
const loading2 = ref(false)

const FullCodeUsageDataMethodsTableDateLsit = ref<any>([])

const FullCodeUsageDataMethods = async () => {
  loading2.value = true
  const result = await FullCodeUsageData(FullCodeUsageDataMethodsParms.value)

  if (result.length !== 0 && result.data !== null) {
    FullCodeUsageDataMethodsTableDateLsit.value = result.map((item: any) => {
      item.change = 'Y'
      item.disableConfirm = true
      return item
    })
  }

  loading2.value = false
}

// 贴合子材料明细
const tableDateList = ref()

const mtlNameSpace = ref({
  mtlName: '',
  mtlSpec: '',
  mtlUnit: ''
})
const vendorList = ref('')
const currentTableRow = ref()
const currentRow3 = async (row: any) => {
  // if(row.mtlNo !== ""){
  //   copyDataParms.value.mtlNo = row.mtlNo
  //   vendorList.value = row.vendor
  // }

  ColorMtl.value = row.mtlColor
  confirmChange20TableDate.value = row
  currentTableRow.value = row
  mtlNameSpace.value.mtlName = row.mtlName
  mtlNameSpace.value.mtlSpec = row.mtlSpec
  mtlNameSpace.value.mtlUnit = row.mtlUnit
  tableDateList.value = row
  mtlNoAny.value = row.mtlNo
  const { mtlNo, segment, partName, seqNo, mtlUnit, mtlColor, mtlName, mtlSpec, vendor } = row
  partNameList.value.partNmae = partName
  partNameList.value.segment = segment
  mtlNoYes.value = mtlNo
  mtlNo1List.value = mtlNo
  LaminatedSubmaterialMethods()
  FullCodeUsageDataMethodsParms.value.partName = partName
  FullCodeUsageDataMethodsParms.value.segment = segment
  FullCodeUsageDataMethods()
  UpdateFullCodeUsageMethodsParmsList.value.push({ partName: partName, segment: segment, change: 'Y' })
  SelectTheCurrentRowToInsertMethodsParms.value.seqNo = seqNo
  SelectTheCurrentRowToInsertMethodsParms.value.segment = segment
  SelectTheCurrentRowToInsertMethodsParms.value.partName = partName
  //
  SelectTheCurrentRowToInsertMethodsParms.value.mtlNo = mtlNo

  const result = await selectMtlName(mtlNameSpace.value)
  if (result !== null) {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = result.mtlUnit
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = result.mtlColor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = result.mtlName
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = result.mtlSpec
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = result.vendor
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = result.mtlNo
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ColorMtl.value
  } else {
    ProductionOfOfficialMaterialsMethodsParms.value.mtlUnit = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlColor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlName = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlSpec = ''
    ProductionOfOfficialMaterialsMethodsParms.value.vendor = ''
    ProductionOfOfficialMaterialsMethodsParms.value.mtlNo = ''
  }

  ProductionOfOfficialMaterialsMethodsParms.value.partName = partName
  ProductionOfOfficialMaterialsMethodsParms.value.seqNo = seqNo
  ProductionOfOfficialMaterialsMethodsParms.value.segment = segment

  InsertTheBondingMaterialMethodsListAParms.value.mtlColor = mtlColor
  InsertTheBondingMaterialMethodsListAParms.value.mtlName = mtlName
  InsertTheBondingMaterialMethodsListAParms.value.mtlNo = mtlNo
  InsertTheBondingMaterialMethodsListAParms.value.mtlSpec = mtlSpec
  InsertTheBondingMaterialMethodsListAParms.value.mtlUnit = mtlUnit
  InsertTheBondingMaterialMethodsListAParms.value.partName = partName
  InsertTheBondingMaterialMethodsListAParms.value.segment = segment
  InsertTheBondingMaterialMethodsListAParms.value.seqNo = seqNo
  InsertTheBondingMaterialMethodsListAParms.value.vendor = vendor

  BondingMaterialTreatmentParms.value.mtlColor = mtlColor
  BondingMaterialTreatmentParms.value.mtlName = mtlName
  BondingMaterialTreatmentParms.value.mtlNo = mtlNo
  BondingMaterialTreatmentParms.value.mtlSpec = mtlSpec
  BondingMaterialTreatmentParms.value.mtlUnit = mtlUnit
  BondingMaterialTreatmentParms.value.partName = partName
  BondingMaterialTreatmentParms.value.segment = segment
  BondingMaterialTreatmentParms.value.seqNo = seqNo

  BondingMaterialTreatmentParms.value.colorCopyTemp = row.colorCopyTemp
  BondingMaterialTreatmentParms.value.orderIdCopyTemp = row.orderIdCopyTemp
  BondingMaterialTreatmentParms.value.styleCopyTemp = row.styleCopyTemp

  //
  BondingMaterialTreatmentParms.value.vendor = vendor
}

const mtlNo1List = ref()

const LaminatedSubmaterialMethodsTableDateLsit = ref<LaminatedSubmaterialInterface[]>()

const LaminatedSubmaterialMethods = async () => {
  loading1.value = true
  const result = await LaminatedSubmaterial({ mtlNo: mtlNo1List.value })
  LaminatedSubmaterialMethodsTableDateLsit.value = result.map((item: any) => {
    if (item.purFlag === 'Y') {
      item.purFlag = true
    }
    if (purFlagList.value) {
      item.change = 'Y'
      item.disableConfirm = true
    }

    return item
  })
  loading1.value = false
}

// 删除型体
const selectedList = (row: any) => {
  DeleteTheCurrentRowDataPmars.value.seqNoList = row.map((item: any) => {
    return item.seqNo
  })

  seqNoList.value = row.map((item: any) => {
    return item
  })
}

const seqNoList = ref([])

const DeleteTheCurrentRowDataPmars = ref<DeleteTheCheckmarkedRecordTypePamrs>({
  seqNoList: [],
  styleColor: '',
  styleNo: ''
})

const DeleteTheCurrentRowData = async () => {
  if (DeleteTheCurrentRowDataPmars.value.seqNoList.length === 0) {
    JMessage.warning('请选择要删除的记录')
    return
  }

  // 保存两个数组用于分类
  const localRecordsToDelete: any = []
  const dbRecordsToDelete: any = []

  // 遍历勾选的序号，分类到本地数据和数据库数据
  DeleteTheCurrentRowDataPmars.value.seqNoList.forEach((seqNo) => {
    const foundRow: any = TypeColorDataQueryMethodsInterfaceTableDateList.value.find((item) => item.seqNo === seqNo)
    if (foundRow) {
      if (foundRow.isLocal) {
        localRecordsToDelete.push(seqNo)
      } else {
        dbRecordsToDelete.push(seqNo)
      }
    }
  })

  // 删除本地记录
  if (localRecordsToDelete.length > 0) {
    TypeColorDataQueryMethodsInterfaceTableDateList.value = TypeColorDataQueryMethodsInterfaceTableDateList.value.filter(
      (item) => !localRecordsToDelete.includes(item.seqNo)
    )
    ReorderList()
    JMessage.success('已删除本地记录')
  }

  // 删除数据库中的记录
  if (dbRecordsToDelete.length > 0) {
    const result = await DeleteTheCheckmarkedRecordType({
      styleColor: UsageChangeQueryMethodsParms.value.styleColor,
      styleNo: UsageChangeQueryMethodsParms.value.styleNo,
      seqNoList: dbRecordsToDelete, // 选中的记录序号
      orderId: UsageChangeQueryMethodsParms.value.orderId
    })

    if (result.code === 200) {
      // 数据库删除成功后，更新数据
      TypeColorDataQueryMethods()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  }

  // 清空选择的序号列表
  DeleteTheCurrentRowDataPmars.value.seqNoList = []
}

const handleCloseMateriaLKlc = (_done?: () => void) => {
  ElMessageBox.confirm('确定要删除该数据吗')
    .then(async () => {
      DeleteTheCurrentRowData()
    })
    .catch(() => {})
}

// 型体颜色材料输入
const loading = ref(false)

const TypeColorDataQueryMethodsPamrs = ref<any>({
  styleNo: '',
  styleColor: '',
  orderId: ''
})

const TypeColorDataQueryMethods = async () => {
  UpdateFullCodeUsageMethodsParmsList.value = []
  loading.value = true
  const reuslt = await TypeColorDataQuery(TypeColorDataQueryMethodsPamrs.value)
  if (reuslt.code === 200) {
    TypeColorDataQueryMethodsInterfaceTableDateList.value = reuslt.data.map((item: any) => {
      if (purFlagList.value) {
        item.change = 'Y'
        item.disableConfirm = true
      } else {
        item.disable = true
      }

      if (item.noLotUsage === 'Y') {
        item.noLotUsage = true
      }
      // item.usageType = {
      //     selectValue: item.usageType || '',
      //     options: []
      // };
      // item.drawDept = {
      //     selectValue: item.drawDept || '',
      //     options: []
      // };
      // item.sizeType = {
      //     selectValue: item.sizeType || '',
      //     options: []
      // };
      // item.mtlProperty = {
      //     selectValue: item.mtlProperty || '',
      //     options: []
      // };
      item.disableConfirm = true
      return item
    })
    if (purFlagList.value) {
      const requiredLength = 40
      const currentLength = TypeColorDataQueryMethodsInterfaceTableDateList.value.length

      // 计算当前最大 seqNo
      const maxSeqNo = TypeColorDataQueryMethodsInterfaceTableDateList.value.reduce((max: any, item: any) => {
        const seqNo = parseInt(item.seqNo, 10) // 将 seqNo 转换为整数
        return seqNo > max ? seqNo : max // 返回最大值
      }, 0) // 初始值为 0

      if (currentLength < requiredLength) {
        const addItem = requiredLength - currentLength

        for (let index = 0; index < addItem; index++) {
          // 复制 AddDetailData 的值并设置 seqNo
          let newDetailData = { ...AddDetailData.value }
          newDetailData.seqNo = (maxSeqNo + index + 1).toString() // 设置 seqNo 为最大值 + index + 1

          // 将新数据添加到列表中
          TypeColorDataQueryMethodsInterfaceTableDateList.value.push(newDetailData as any)
        }
      }
    }

    if (reuslt.data.length > 0) {
      UpdateFullCodeUsageMethodsParmsList.value.push({ partNmae: reuslt.data[0].partName, segment: reuslt.data[0].segment })
      FullCodeUsageDataMethodsParms.value.partName = reuslt.data[0].partName
      FullCodeUsageDataMethodsParms.value.segment = reuslt.data[0].segment
      formList9.value[0].inputValue = reuslt.data.length + 1
      mtlNo1List.value = reuslt.data[0].mtlNo
      mtlNoYes.value = reuslt.data[0].mtlNo
      FullCodeUsageDataMethods()
      LaminatedSubmaterialMethods()
    }

    saveDateListMethodsParms.value.styleColorMaterialRequests = TypeColorDataQueryMethodsInterfaceTableDateList.value
  }
  loading.value = false
}
// 新增

const listAdd = async () => {
  // listAddParms.value.colorCode === '' ? listAddParms.value.colorCode : listAddParms.value.colorCode = null
  const reuslt = await LoginWork.post<any, any>('/developmentUsage/getStyleUsageAdd', listAddParms.value)
  if (reuslt.code === 200) {
    // listAddParms.value.colorCode = ''
    // listAddParms.value.styleColor = ''
    // listAddParms.value.styleNo = ''
    // formList.value[0].inputValue = ''
    // formList1.value[0].inputValue = ''
    // formList1.value[1].inputValue = ''
    // ColorCodePictureMethodsParms.value.styleColor = ''
    // ColorCodePictureMethodsParms.value.colorCode = ''
    TypeQueryMethods()
    JMessage.success(reuslt.message)
  } else {
    // listAddParms.value.colorCode = ''
    // listAddParms.value.styleColor = ''
    // listAddParms.value.styleNo = ''
    // ColorCodePictureMethodsParms.value.styleColor = ''
    // ColorCodePictureMethodsParms.value.colorCode = ''
    // formList.value[0].inputValue = ''
    // formList1.value[0].inputValue = ''
    // formList1.value[1].inputValue = ''
    TypeQueryMethods()
    JMessage.error(reuslt.message)
  }
}

// 左侧表格

// 颜色图片代码
const Launchform1 = (row: any) => {
  TypeQueryMethodsPamrs.value.styleNo = row[0].inputValue
  listAddParms.value.styleNo = row[0].inputValue
  ColorCodePictureMethodsParms.value.styleNo = row[0].inputValue

  TypeQueryMethodsPamrs1.value.style = row[0].inputValue

  ColorCodePictureMethodsParms.value.colorCode = row[2].inputValue
  ColorCodePictureMethodsParms.value.styleColor = row[1].inputValue
  listAddParms.value.orderId = row[2].inputValue
  listAddParms.value.styleColor = row[1].inputValue
  // ColorCodePictureMethods()
  // TypeColorDataQueryMethods()

  TypeQueryMethodsPamrs1.value.color = row[1].inputValue
  TypeQueryMethodsPamrs1.value.colorCode = row[2].inputValue
  console.log(row)
}

const imgList = ref<any>([])

const currentRow1 = (row: any) => {
  const { style, orderId } = row
  styleNoParms.value.styleNo = style
  ColorCodePictureMethodsParms.value.styleNo = style
  TypeColorDataQueryMethodsPamrs.value.styleNo = style
  TypeColorDataQueryMethodsPamrs.value.orderId = orderId
  FullCodeUsageDataMethodsParms.value.styleNo = style
  FullCodeUsageCheckMethodsParms.value.styleNo = style
  saveDateListMethodsParms.value.styleNo = style
  UsageChangeQueryMethodsParms.value.styleNo = style
  TypeColorDataQueryMethodsPamrs.value.orderId = orderId
  CopyDataMethodsPamrs.value.styleNo = style
  SelectTheCurrentRowToInsertMethodsParms.value.styleNo = style
  InsertTheBondingMaterialMethodsListAParms.value.styleNo = style
  ubdateSizeNoMethodsParms.value.styleNo = style
  TypeQueryMethodsPamrs1.value.style = style
  BondingMaterialTreatmentParms.value.styleNo = style
  ProductionOfOfficialMaterialsMethodsParms.value.styleNo = style
  copyDataParms.value.styleNo = style
  ColorCodeQueryMethodsParms.value.styleNo = style
  ColorCodePictureMethods()
}

const ColorCodePictureMethodsParms = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodePictureMethodsParmsTableDateList = ref<ColorCodePictureTableDate>({
  list: []
})
const indexList = ref()
const currentRow2 = (row: any) => {
  indexList.value = ColorCodePictureMethodsParmsTableDateList.value.list.findIndex((item: any) => item === row)
  imgList.value[0] = row.photoPath
  if (row.cfmFlag !== 'Y') {
    purFlagList.value = true
  } else {
    purFlagList.value = false
  }
  image.value = row.photoPath
  formList2.value[11].inputValue = row.remark
  styleNoParms.value.styleColor = row.styleColor
  styleNoParms.value.cfmFlag = row.cfmFlag
  styleNoParms.value.orderId = row.orderId
  TypeColorDataQueryMethodsPamrs.value.styleColor = row.styleColor
  TypeColorDataQueryMethodsPamrs.value.orderId = row.orderId
  FullCodeUsageDataMethodsParms.value.styleColor = row.styleColor
  FullCodeUsageCheckMethodsParms.value.styleColor = row.styleColor
  saveDateListMethodsParms.value.styleColor = row.styleColor
  UsageChangeQueryMethodsParms.value.styleColor = row.styleColor
  UsageChangeQueryMethodsParms.value.colorCode = row.colorCode
  UsageChangeQueryMethodsParms.value.orderId = row.orderId
  CopyDataMethodsPamrs.value.styleColor = row.styleColor
  CopyDataMethodsPamrs.value.colorCode = row.colorCode
  CopyDataMethodsPamrs.value.orderId = row.orderId
  InsertTheBondingMaterialMethodsListAParms.value.colorCode = row.colorCode
  BondingMaterialTreatmentParms.value.styleColor = row.styleColor
  copyDataParms.value.styleColor = row.styleColor
  ubdateSizeNoMethodsParms.value.styleColor = row.styleColor
  SelectTheCurrentRowToInsertMethodsParms.value.styleColor = row.styleColor
  ProductionOfOfficialMaterialsMethodsParms.value.styleColor = row.styleColor
  TypeColorDataQueryMethods()
  saveDateListMethodsParms.value.styleColorRemark = row.remark
  cfmFlagList.value = row.cfmFlag

  TypeQueryMethodsPamrs1.value.color = row.styleColor
  TypeQueryMethodsPamrs1.value.colorCode = row.colorCode
}

const purFlagList = ref(false)

const isLoading15 = ref(false)

const ColorCodePictureMethods = async () => {
  isLoading15.value = true
  const result = await ColorCodePicture(ColorCodePictureMethodsParms.value)
  if (result.list.length !== 0) {
    ColorCodePictureMethodsParmsTableDateList.value.list = result.list.map((item: any) => {
      if (item.cfmFlag === 'Y') {
        item.backgroundColor = '#80FF00'
        cfmFlagList.value = 'Y'
      } else {
        cfmFlagList.value = null
      }
      return item
    })
  }

  if (result.list.length > 0) {
    if (result.list[0].cfmFlag !== 'Y') {
      purFlagList.value = true
    } else {
      purFlagList.value = false
    }
    TypeColorDataQueryMethodsPamrs.value.styleColor = result.list[0].styleColor
    TypeColorDataQueryMethodsPamrs.value.orderId = result.list[0].orderId
    FullCodeUsageDataMethodsParms.value.styleColor = result.list[0].styleColor
    FullCodeUsageCheckMethodsParms.value.styleColor = result.list[0].styleColor
    ubdateSizeNoMethodsParms.value.styleColor = result.list[0].styleColor
    saveDateListMethodsParms.value.styleColor = result.list[0].styleColor
    UsageChangeQueryMethodsParms.value.styleColor = result.list[0].styleColor
    UsageChangeQueryMethodsParms.value.colorCode = result.list[0].colorCode
    UsageChangeQueryMethodsParms.value.orderId = result.list[0].orderId
    saveDateListMethodsParms.value.styleColorRemark = result.list[0].remark
    CopyDataMethodsPamrs.value.styleColor = result.list[0].styleColor
    CopyDataMethodsPamrs.value.colorCode = result.list[0].colorCode
    SelectTheCurrentRowToInsertMethodsParms.value.styleColor = result.list[0].styleColor
    ProductionOfOfficialMaterialsMethodsParms.value.styleColor = result.list[0].styleColor
    InsertTheBondingMaterialMethodsListAParms.value.styleColor = result.list[0].styleColor
    BondingMaterialTreatmentParms.value.styleColor = result.list[0].styleColor
    copyDataParms.value.styleColor = result.list[0].styleColor
    image.value = result.list[0].photoPath
    formList2.value[11].inputValue = result.list[0].remark
    imgList.value[0] = result.list[0].photoPath
    styleNoParms.value.styleColor = result.list[0].styleColor
    styleNoParms.value.cfmFlag = result.list[0].cfmFlag
    styleNoParms.value.orderId = result.list[0].orderId
    CopyDataMethodsPamrs.value.orderId = result.list[0].orderId
    TypeColorDataQueryMethods()

    TypeQueryMethodsPamrs1.value.color = result.list[0].styleColor
    TypeQueryMethodsPamrs1.value.colorCode = result.list[0].colorCode
  }
  // total.value = result.total!
  isLoading15.value = false
}

const total = ref(0)

const handleSizeChange = (val: number) => {
  ColorCodePictureMethodsParms.value.pageSize = val
  ColorCodePictureMethods()
}

const handleCurrentChange = (val: number) => {
  ColorCodePictureMethodsParms.value.pageNum = val
  ColorCodePictureMethods()
}

// 型体
const isLoading11 = ref(true)

const Launchform = (row: any) => {
  TypeQueryMethodsPamrs.value.styleNo = row[0].inputValue
  listAddParms.value.styleNo = row[0].inputValue
  ColorCodePictureMethodsParms.value.styleNo = row[0].inputValue

  TypeQueryMethodsPamrs1.value.style = row[0].inputValue
}

// 颜色代码更新
const ColorCodeQueryMethodsParms = ref<ColorCodePictureParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const ColorCodeUpdateMethods = async () => {
  try {
    const result = await LoginWork.post<any, any>(`/developmentUsage/ColorCodeUpdate?styleNo=${ColorCodeQueryMethodsParms.value.styleNo}`)
    if (result.code === 200) {
      TypeQueryMethods()
      JMessage.success(result.message)
    } else {
      JMessage.warning(result.message)
    }
  } catch (error) {
    JMessage.error('颜色代码更新失败请重试')
  }
}

const findClicked = (count: string) => {
  if (count === '颜色代码更新') {
    ColorCodeUpdateMethods()
  }
  if (count === '新增') {
    if (ColorCodePictureMethodsParms.value.styleColor === '' || ColorCodePictureMethodsParms.value.styleNo === '') {
      JMessage.warning('型体颜色名称颜色代号都不可为空')
    } else {
      listAdd()
    }
  }
  if (count === '检核') {
    FullNnumer.value = 0
    FullCodeUsageCheckMethods()
  }
  if (count === '取消检核') {
    FullNnumer.value = 1
    FullCodeUsageCheckMethods()
  }
  if (count === '保存') {
    saveDateListMethods()
  }
  if (count === '查询') {
    TypeQueryMethods()
  }
  if (count === '置空') {
    clearFormList15()
  }
}

const TypeQueryMethodsPamrs = ref<TypeQueryParms>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  styleColor: '',
  styleNo: ''
})

const TypeQueryMethodsPamrs1 = ref<any>({
  colorCode: '',
  pageNum: 1,
  pageSize: 40,
  color: '',
  style: ''
})

const TypeQueryMethodsTableDateList = ref([])

const TypeQueryMethods = async () => {
  isLoading11.value = true
  const result = await TypeQuery(TypeQueryMethodsPamrs.value)

  if (result.data !== null) {
    if (result.list.length > 0) {
      TypeQueryMethodsTableDateList.value = result.list.map((item: any) => {
        return { style: item }
      })
      ColorCodePictureMethodsParms.value.styleNo = result.list[0]
      TypeColorDataQueryMethodsPamrs.value.styleNo = result.list[0]
      FullCodeUsageDataMethodsParms.value.styleNo = result.list[0]
      FullCodeUsageCheckMethodsParms.value.styleNo = result.list[0]
      saveDateListMethodsParms.value.styleNo = result.list[0]
      UsageChangeQueryMethodsParms.value.styleNo = result.list[0]
      CopyDataMethodsPamrs.value.styleNo = result.list[0]
      SelectTheCurrentRowToInsertMethodsParms.value.styleNo = result.list[0]
      ProductionOfOfficialMaterialsMethodsParms.value.styleNo = result.list[0]
      InsertTheBondingMaterialMethodsListAParms.value.styleNo = result.list[0]
      TypeQueryMethodsPamrs1.value.style = result.list[0]
      BondingMaterialTreatmentParms.value.styleNo = result.list[0]
      copyDataParms.value.styleNo = result.list[0]
      ColorCodeQueryMethodsParms.value.styleNo = result.list[0]
      styleNoParms.value.styleNo = result.list[0]

      ubdateSizeNoMethodsParms.value.styleNo = result.list[0]

      ColorCodePictureMethods()
    } else {
      JMessage.warning('暂无该型体数据')
    }
  } else {
    JMessage.error(result.message)
  }

  totalTk.value = result.total
  isLoading11.value = false
}

const totalTk = ref(0)

const handleSizeChangeTk = (val: number) => {
  TypeQueryMethodsPamrs.value.pageSize = val
  TypeQueryMethods()
}

const handleCurrentChangeTk = (val: number) => {
  TypeQueryMethodsPamrs.value.pageNum = val
  TypeQueryMethods()
}

// 统一调用接口
const interAceFunct = () => {
  // 选择型体
  TypeQueryMethods()

  GetVendorListMethods()
}

onMounted(() => {
  interAceFunct()
})

const listAddParms = ref<any>({
  orderId: '',
  styleColor: '',
  styleNo: ''
})

interface listAddParmsList {
  colorCode: string | null
  styleColor: string
  styleNo: string
}

// 左侧表格数据
const tableHeader = ref([
  {
    label: '型体',
    prop: 'style'
  }
])

const tableHeader2 = ref([
  {
    label: '颜色',
    prop: 'styleColor',
    change: true,
    backgroundColor: true
  },
  {
    label: '颜色代号',
    prop: 'colorCode',
    change: true
  },
  {
    label: '样品类型',
    prop: 'sampleType',
    change: true
  },
  {
    label: '号码',
    prop: 'sizeNo',
    change: true
  }
  // {
  //   label: '图片', fixed: true,
  //   prop: "photoPath",
  //   width: '80',
  //   type: 'img',
  //   srcList: imgList
  // },
])

const tableHeader3 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    width: '50',
    change: true
  },
  {
    label: '部位   ',
    width: '100',
    prop: 'partName'
  },
  {
    label: '分段',
    prop: 'segment',
    width: '50',
    change: true
  },
  {
    label: '物料编码',
    prop: 'mtlNo',
    width: '100'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor',
    change: true,
    width: '200'
  },
  {
    start: true,
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    width: '50',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    width: '50',
    change: true
  },
  // {
  //   label: '尺码起',
  //   prop: 'size1',
  //   width: '50',
  // },
  // {
  //   label: '尺码止',
  //   prop: 'size2',
  //   width: '50',
  // },
  {
    label: '供应商 ',
    prop: 'vendor',
    width: '50'
  },
  // {
  //   label: '用量',
  //   prop: 'usage',
  //   width: '60',
  // },
  // {
  //   label: '计算方式',
  //   prop: 'usageType',
  //   width: '100',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '领用单位',
  //   prop: 'drawDept',
  //   width: '50',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '号码类型',
  //   prop: 'sizeType',
  //   width: '50',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '主辅料',
  //   prop: 'mtlProperty',
  //   width: '100',
  //   type: 'select',
  //   disable: true,
  // },
  // {
  //   label: '捡料',
  //   prop: 'noLotUsage',
  //   type: 'checkbox',
  //   width: '50',
  // },
  {
    label: '备注',
    prop: 'remark',
    width: '100'
  },
  {
    label: '供货方式',
    prop: 'vendorType',
    width: '100'
  },
  {
    label: '联系方式',
    prop: 'phone',
    width: '100'
  },
  {
    label: '部件加工方式',
    prop: 'process',
    width: '100'
  }
])

const tableHeader5 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo',
    width: '80',
    change: true
  },
  {
    label: '材料颜色',
    width: '80',
    prop: 'mtlColor',
    change: true
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    change: true
  },
  {
    label: '加工方式',
    prop: 'prdType',
    change: true
  },
  {
    label: '供应商',
    prop: 'vendor',
    change: true
  },
  {
    label: '比例',
    prop: 'percent'
  },
  {
    label: '是否请购',
    prop: 'purFlag',
    type: 'checkbox'
  }
])

const tableHeader7 = ref([
  {
    label: '号码',
    prop: 'sizeFrom'
  },
  {
    label: '用量',
    prop: 'mtlUsage'
  }
])

const tableHeaderStyleNo = ref([
  {
    label: '颜色名称',
    prop: 'styleColor'
  },
  {
    label: '颜色代码',
    prop: 'colorCode'
  },
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '号码',
    prop: 'sizeNo'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  }
])

const tableHeaderStyleNo1 = ref([
  {
    label: '颜色名称',
    prop: 'styleColor'
  },
  {
    label: '颜色代码',
    prop: 'colorCode'
  },
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '号码',
    prop: 'sizeNo'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  }
])

const tableHeader8 = ref([
  {
    label: '型体',
    prop: 'styleNo'
  },
  {
    label: '颜色',
    prop: 'styleColor'
  },
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '部位',
    prop: 'partName'
  },
  {
    label: '分段',
    prop: 'segment'
  },
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '尺码起',
    prop: 'size1'
  },
  {
    label: '尺码止',
    prop: 'size2'
  },
  {
    label: '供应商',
    prop: 'vendor'
  },
  {
    label: '用量',
    prop: 'usage'
  },
  {
    label: '计算方式',
    prop: 'usageType'
  },
  {
    label: '领用单位',
    prop: 'drawDept'
  },
  {
    label: '号码类型',
    prop: 'sizeType'
  },
  {
    label: '主辅料',
    prop: 'mtlProperty'
  },
  {
    label: '捡料',
    prop: 'noLotUsage',
    type: 'checkbox'
  },
  {
    label: '备注',
    prop: 'remark'
  }
])

const tableHeader9 = ref([
  {
    label: '号码',
    prop: 'sizeFrom'
  },
  {
    label: '用量',
    prop: 'mtlUsage'
  }
])

const tableHeader10 = ref([
  {
    label: '部位',
    prop: 'partName',
    width: '50'
  },
  {
    label: '分段',
    prop: 'segment',
    width: '60'
  },
  {
    label: '变更类型',
    prop: 'changeType',
    width: '90'
  },
  {
    label: '变更内容',
    prop: 'remark'
  },
  {
    label: '操作时间',
    prop: 'sysDate',
    width: '150'
  },
  {
    label: '操作员',
    prop: 'sysUser',
    width: '60'
  }
])

const tableHeader11 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    width: '50',
    change: true
  },
  {
    label: '事项名称',
    prop: 'seqName',
    change: true
  },
  {
    label: '注意事项',
    prop: 'prodMemo'
  }
])

const tableHeader12 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料颜色',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    width: '300'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '供应商',
    prop: 'vendor'
  }
])

const tableHeader13 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    width: '300'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '单位',
    prop: 'mtlUnit'
  },
  {
    label: '供应商',
    prop: 'vendor'
  }
])

const tableHeader15 = ref([
  {
    label: '色系',
    prop: 'colorSystem'
  },
  {
    label: '颜色',
    prop: 'colorName'
  },
  {
    label: 'PANTONE',
    prop: 'pantone'
  },
  {
    label: '颜色(英)',
    prop: 'engColor'
  }
])

const tableHeader16 = ref([
  {
    label: '型体',
    prop: 'styleNo'
  },
  {
    label: '颜色',
    prop: 'styleColor'
  },
  {
    label: '冲刀号(起)',
    prop: 'minCutSize'
  },
  {
    label: '冲刀号(止)',
    prop: 'maxCutSize'
  }
])

const tableHeader17 = ref([
  {
    label: '物料编码',
    prop: 'mtlNo',
    change: true
  },
  {
    label: '材料颜色 ',
    prop: 'mtlColor'
  },
  {
    label: '材料名称',
    prop: 'mtlName',
    change: true
  },
  {
    label: '规格',
    prop: 'mtlSpec',
    change: true
  },
  {
    label: '单位',
    prop: 'mtlUnit',
    change: true
  },
  {
    label: '加工方式',
    prop: 'prdType',
    type: 'select'
  },
  {
    label: '供应商  ',
    prop: 'vendor',
    type: 'select'
  },
  {
    label: '比例',
    prop: 'percent'
  },
  {
    label: '请购否',
    type: 'checkbox',
    prop: 'purFlag'
  }
])

const tableHeader19 = ref([
  {
    label: '序号',
    prop: 'seqNo',
    change: true,
    width: '90'
  },
  {
    label: '事项名称',
    prop: 'seqName',
    change: true,
    width: '90'
  },
  {
    textarea: true,
    label: '注意事项',
    prop: 'prodMemo'
  }
])
</script>
<style lang="less" scoped>
:deep(.el-input__suffix) {
  display: none;
}
.btns {
  display: flex;
  justify-content: space-between;

  .bg {
    background-color: #e7e7e7;
    border: 1px solid #e7e7e7;
    color: #000000;
  }
}

.mt10 {
  width: 20%;
}

.mt24 {
  margin-top: 10px;
}

h1 {
  font-size: 16px;
}

// 圆的改成方的
:deep(.el-radio__inner) {
  border: 1px solid #dcdfe6;
  border-radius: 2px;
  width: 14px;
  height: 14px;
  background-color: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

// 文字和单选之间的距离
:deep(.el-radio__label) {
  padding-left: 5px;
}

// 选中状态改变成对钩
:deep(.el-radio__input.is-checked .el-radio__inner::after) {
  content: '';
  width: 8px;
  height: 5px;
  border: 2px solid white;
  border-top: transparent;
  border-right: transparent;
  text-align: center;
  display: block;
  position: absolute;
  top: 2px;
  left: 2px;
  vertical-align: middle;
  transform: rotate(-45deg);
  border-radius: 0px;
  background: none;
}

:deep(.el-radio__input.is-checked + .el-radio__label) {
  color: #606266;
}

// :deep(.el-input .el-input--small .el-input--suffix .el-input__inner){
//   height: 100px;
// }
</style>
